ODBCPermissionAttribute Class

[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Module | AttributeTargets.Property | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] public sealed class ODBCPermissionAttribute : CodeAccessSecurityAttribute

Represents an attribute that is used to grant or deny ODBCPermission permission to code access security.

This attribute can be applied to code entities such as assemblies, classes, methods, modules, properties, and structs to define their security requirements related to ODBC access.

Syntax

public sealed class ODBCPermissionAttribute : CodeAccessSecurityAttribute

Remarks

The ODBCPermissionAttribute class enables you to apply security actions declaratively to your code. By applying this attribute, you can control the permissions that your code requires to perform operations involving ODBC data sources. This is crucial for enforcing security policies and preventing unauthorized access to sensitive data.

When the common language runtime (CLR) loads code that has an ODBCPermissionAttribute applied, it creates and configures a ODBCPermission object based on the attribute's properties. The CLR then performs a demand for this permission object.

Constructors

Properties

Methods

Examples

The following example demonstrates how to apply the ODBCPermissionAttribute to an assembly to grant unrestricted ODBC access.

// Apply to the entire assembly
[assembly: ODBCPermission(SecurityAction.Demand, Unrestricted = true)]

public class MyOdbcApplication
{
    public void AccessOdbcData()
    {
        // Code that accesses ODBC data sources
        // ...
    }
}

Requirements