Share via


DataSourceAttribute Constructor (String, String, String, DataAccessMethod)

Initializes a new instance of the DataSourceAttribute class. This instance will be initialized with a data provider, connection string, data table and data access method to access the data source.

Namespace:  Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

Syntax

'Declaration
Public Sub New ( _
    providerInvariantName As String, _
    connectionString As String, _
    tableName As String, _
    dataAccessMethod As DataAccessMethod _
)
public DataSourceAttribute(
    string providerInvariantName,
    string connectionString,
    string tableName,
    DataAccessMethod dataAccessMethod
)
public:
DataSourceAttribute(
    String^ providerInvariantName, 
    String^ connectionString, 
    String^ tableName, 
    DataAccessMethod dataAccessMethod
)
new : 
        providerInvariantName:string * 
        connectionString:string * 
        tableName:string * 
        dataAccessMethod:DataAccessMethod -> DataSourceAttribute
public function DataSourceAttribute(
    providerInvariantName : String, 
    connectionString : String, 
    tableName : String, 
    dataAccessMethod : DataAccessMethod
)

Parameters

  • providerInvariantName
    Type: String

    Invariant data provider name, such as System.Data.SqlClient.

  • connectionString
    Type: String

    A data provider-specific connection string.

  • tableName
    Type: String

    The name of the data table.

Remarks

Note

The connection string can contain sensitive data (for example, a password). The connection string is stored in plain text in source code and in the compiled assembly. Restrict access to the source code and assembly to protect this sensitive information.

.NET Framework Security

See Also

Reference

DataSourceAttribute Class

DataSourceAttribute Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace

DataAccessMethod