473,729 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

declarative security on abstract classes

Is there a way to do declarative security on abstract classes? I am working
on a data access layer and would like to place all permission requirements on
the base class so all inherited classes contain the permissions. Is this
possible, and if so can anyone provide an example?
Jun 21 '06 #1
2 1304
Hi Nick,

Declarative security works the same with an abstract class as it does with
no class modifier.

[System.Security .Permissions.Se curityPermissio n(System.Securi ty.Permissions. SecurityAction. Demand,Infrastr ucture = true)] abstract class myclass { [System.Security .Permissions.Se curityPermissio n(System.Securi ty.Permissions. SecurityAction. Demand, Infrastructure = true)] protected abstract void mymethod(); }"Nick" <nt********@onl ine.nospam> wrote in messagenews:2B* *************** *************** ***@microsoft.c om...> Is there a way to do declarative security on abstract classes? I amworking> on a data access layer and would like to place all permission requirementson> the base class so all inherited classes contain the permissions. Is this> possible, and if so can anyone provide an example?

Jun 21 '06 #2
Hmm I don't know why my original response got all jumbled. I fixed the
example to watch for wrapping this time:

[System.Security .Permissions.Se curityPermissio n(
System.Security .Permissions.Se curityAction.De mand,
Infrastructure = true)]
abstract class myclass {

[System.Security .Permissions.Se curityPermissio n(
System.Security .Permissions.Se curityAction.De mand,
RemotingConfigu ration = true)]
protected abstract void mymethod();

}
"Dave Sexton" <dave@jwa[remove.this]online.com> wrote in message
news:OA******** *****@TK2MSFTNG P03.phx.gbl...
Hi Nick,

Declarative security works the same with an abstract class as it does with
no class modifier.

[System.Security .Permissions.Se curityPermissio n(System.Securi ty.Permissions. SecurityAction. Demand,Infrastr ucture
= true)] abstract class myclass {
[System.Security .Permissions.Se curityPermissio n(System.Securi ty.Permissions. SecurityAction. Demand,
Infrastructure = true)] protected abstract void mymethod(); }"Nick"
<nt********@onl ine.nospam> wrote in
messagenews:2B* *************** *************** ***@microsoft.c om...> Is
there a way to do declarative security on abstract classes? I amworking>
on a data access layer and would like to place all permission
requirementson> the base class so all inherited classes contain the
permissions. Is this> possible, and if so can anyone provide an example?

Jun 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
3092
by: Daedalus.OS | last post by:
Ok first I'm pretty new to OOP, so my question may sound stupid to some of you. If the only answer you can provide is "get a book about OOP" then don't loose your time and mine cause it's already ordered. I'm just too curious about this one to wait for the book. I would like to know is if it's good php programming practice to use abstract classes instead of singleton classes. For exemple a login class. I've made one as an abstract class...
2
9605
by: Dave Veeneman | last post by:
Is is legal to declare abstract members in non-abstract classes? How about non-abstract members in abstract classes? I am writing a base class with three derived classes. The base class will define the behavior for most, but not all of its members. The derived classes will define the behavior for the remaining members (the undefined members). I'd like to force the derived classes to implement the undefined members in the base class. I...
18
3780
by: Bradley | last post by:
I'm trying to determine if there's a general rule for when an Interface should used vs. an Abstract Class. Is there any design advantage to using one or the other? Brad
9
5199
by: Sean Kirkpatrick | last post by:
To my eye, there doesn't seem to be a whole lot of difference between the two of them from a functional point of view. Can someone give me a good explanation of why one vs the other? Sean
8
18585
by: Manuel | last post by:
Hi! If I've a vector filled with abstract classes, can I push in it the derived classes too? Even if derived classes have new methods? I've done some experiments, and it seem I can push the derived classes, but I can use them only calling the methods declared in abstract class (the new methods declared only in derived classes return an error). Please take a look to my code (hey, this is not an homework!
4
3201
by: N.RATNAKAR | last post by:
hai, what is abstract class and abstract method
0
2830
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass magic, I wrote the following module. It is mainly useful as a light weight tool to help programmers catch mistakes at definition time (e.g., forgetting to implement a method required by the given interface). This is handy when unit tests or...
6
4031
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it would be useful to have /some/ data defined in such an abstract class for reasons of forming a common block of data existing in or used by all descendant classes (see example below.) In such a case where a common block of data *always* exists,...
5
3016
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I am actually a VB.Net guy, but I have worked somewhat with C++ and C#. I just want to ask about the relationship between Abstract Classes and Interfaces. My first question is if C# even has Iinterfaces. I took some Java programming classes and Interfaces are a main staple of Java. And in VB.Net I use interfaces for setting up definitions of classes. I am guessing that Abstract classes in C# do the same thing as...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.