DekGenius.com
[ Team LiB ] Previous Section Next Section

DBDataPermission serializable

System.Data.Common (system.data.dll) abstract class

DBDataPermission represents the security level access to a database. It's an abstract class (providers derive their own specific permission class), which allows you to ensure that the current user has required code access security permissions. For example, if you use the Demand( ) method before attempting to open a connection and the current user lacks the required security permissions, your code receives a System.Security.SecurityException to be handled gracefully. If you don't call Demand( ) , System.Security.SecurityException is still raised, but it won't occur until your code attempts the disallowed action.

Remember that this setting pertains only to code access security. It has to do with authentication. By default, any client running .NET code is allowed to open a connection. However, you can modify code access permissions (for example, denying users permission to use a connection string with a blank password) using the .NET Framework Configuration Tool.

You can also use the Deny( ) to programmatically revoke the client's ability to access the data source. This will remain in effect until the current method returns (and will apply to any methods further down the call stack).

public abstract class DBDataPermission : System.Security.CodeAccessPermission , System.Security.Permissions
        IUnrestrictedPermission {
// Public Constructors
   public DBDataPermission(System.Security.Permissions.PermissionState state, bool allowBlankPassword);
// Protected Constructors
   protected DBDataPermission(  );  
   protected DBDataPermission( DBDataPermission permission);  
   protected DBDataPermission(DBDataPermissionAttribute permissionAttribute);
   protected DBDataPermission(System.Security.Permissions.PermissionState state);
// Public Instance Properties
   public bool AllowBlankPassword{set; get; } 
// Public Instance Methods
   public virtual void Add(string connectionString, string restrictions, System.Data.KeyRestrictionBehavior behavior);
   public override IPermission Copy(  );                         // overrides CodeAccessPermission
   public override void FromXml(System.Security.SecurityElement securityElement);                // overrides CodeAccessPermission
   public override IPermission Intersect(System.Security.IPermission target);                      // overrides CodeAccessPermission
   public override bool IsSubsetOf(System.Security.IPermission target);                            // overrides CodeAccessPermission
   public bool IsUnrestricted(  );                     // implements IUnrestrictedPermission
   public override SecurityElement ToXml(  );                    // overrides CodeAccessPermission
   public override IPermission Union(System.Security.IPermission target);                          // overrides CodeAccessPermission
// Protected Instance Methods
   protected void Clear(  );  
   protected virtual DBDataPermission CreateInstance(  );  
}

Hierarchy

System.Object figs/U2192.gif System.Security.CodeAccessPermission(System.Security.IPermission, System.Security.ISecurityEncodable , System.Security.IStackWalk) figs/U2192.gif DBDataPermission(System.Security.Permissions.IUnrestrictedPermission)

Subclasses

System.Data.OleDb.OleDbPermission , System.Data.SqlClient.SqlClientPermission

    [ Team LiB ] Previous Section Next Section