Provider-specific attributes that derive from this class identify custom security attributes for certain actions. This is how it works: by default, .NET code has full access to attempt any actions using managed providers. However, using the .NET Framework Configuration tool (installed to the Administrative Tools group), you can modify these permissions. Currently, there are only two additional restrictions you can impose: denying the right to use blank passwords in a connection string, and restricting the allowed OLE DB drivers that managed OLE DB provider can use. (These settings are translated to specific entries in the machine.config file for your computer.) If you use impose these restrictions, you may want to identify an area of your code that requires a certain permission (such as the ability to use a blank password). You identify these areas using an attribute derived from DBDataPermissionAttribute. By identifying these areas, you ensure only one thing: if the required privilege isn’t allowed, an exception will be thrown before .NET attempts to run the identified code.

You can apply an attribute derived from DBDataPermissionAttribute to an assembly, class, struct, constructor, or method.

public abstract class DBDataPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute {

// Protected Constructors

   protected DBDataPermissionAttribute(System.Security.Permissions.SecurityAction action);

// Public Instance Properties

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.