By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

declarative security on abstract classes

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Nick,

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

[System.Security.Permissions.SecurityPermission(Sys tem.Security.Permissions.SecurityAction.Demand,Inf rastructure = true)] abstract class myclass { [System.Security.Permissions.SecurityPermission(Sys tem.Security.Permissions.SecurityAction.Demand, Infrastructure = true)] protected abstract void mymethod(); }"Nick" <nt********@online.nospam> wrote in messagenews:2B**********************************@m icrosoft.com...> 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

P: n/a
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.SecurityPermission(
System.Security.Permissions.SecurityAction.Demand,
Infrastructure = true)]
abstract class myclass {

[System.Security.Permissions.SecurityPermission(
System.Security.Permissions.SecurityAction.Demand,
RemotingConfiguration = true)]
protected abstract void mymethod();

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

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

[System.Security.Permissions.SecurityPermission(Sys tem.Security.Permissions.SecurityAction.Demand,Inf rastructure
= true)] abstract class myclass {
[System.Security.Permissions.SecurityPermission(Sys tem.Security.Permissions.SecurityAction.Demand,
Infrastructure = true)] protected abstract void mymethod(); }"Nick"
<nt********@online.nospam> wrote in
messagenews:2B**********************************@m icrosoft.com...> 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 discussion thread is closed

Replies have been disabled for this discussion.