C# Class Tortuga.Chain.SqlServerDataSource

Class SqlServerDataSource.
Inheritance: SqlServerDataSourceBase, IRootDataSource
Exibir arquivo Open project: docevaad/Chain Class Usage Examples

Private Properties

Property Type Description
BuildConnectionSettingsOverride string
CreateConnection System.Data.SqlClient.SqlConnection
CreateConnectionAsync Task
Execute int?
GetEffectiveSettings Tortuga.Chain.SqlServer.SqlServerEffectiveSettings
GetEffectiveSettingsAsync Task
IRootDataSource System.Data.Common.DbConnection
IRootDataSource IOpenDataSource
IRootDataSource ITransactionalDataSource
IRootDataSource Task
IRootDataSource Task
SqlServerDataSource System

Public Methods

Method Description
BeginTransaction ( string transactionName = null, IsolationLevel isolationLevel = null, bool forwardEvents = true ) : SqlServerTransactionalDataSource

Creates a new transaction

the caller of this function is responsible for closing the transaction.

BeginTransactionAsync ( string transactionName = null, IsolationLevel isolationLevel = null, bool forwardEvents = true ) : Task

Creates a new transaction

CreateFromConfig ( string connectionName ) : SqlServerDataSource

Creates a new connection using the connection string settings in the app.config file.

SqlServerDataSource ( System.Data.SqlClient.SqlConnectionStringBuilder connectionStringBuilder, SqlServerDataSourceSettings settings = null ) : System

Initializes a new instance of the SqlServerDataSource class.

SqlServerDataSource ( string name, System.Data.SqlClient.SqlConnectionStringBuilder connectionStringBuilder, SqlServerDataSourceSettings settings = null ) : System

Initializes a new instance of the SqlServerDataSource class.

SqlServerDataSource ( string connectionString, SqlServerDataSourceSettings settings = null ) : System

Initializes a new instance of the SqlServerDataSource class.

SqlServerDataSource ( string name, string connectionString, SqlServerDataSourceSettings settings = null ) : System

Initializes a new instance of the SqlServerDataSource class.

StartSqlDependency ( ) : bool

Starts SQL dependency.

true if the listener initialized successfully; false if a compatible listener already exists.

StopSqlDependency ( ) : bool

Stops SQL dependency.

true if the listener was completely stopped; false if the System.AppDomain was unbound from the listener, but there are is at least one other System.AppDomain using the same listener.

TestConnection ( ) : void

Tests the connection.

TestConnectionAsync ( ) : Task

Tests the connection asynchronously.

WithCache ( ICacheAdapter cache ) : SqlServerDataSource

Craetes a new data source with the provided cache.

WithRules ( ) : SqlServerDataSource

Creates a new data source with additional audit rules.

WithRules ( IEnumerable additionalRules ) : SqlServerDataSource

Creates a new data source with additional audit rules.

WithSettings ( SqlServerDataSourceSettings settings ) : SqlServerDataSource

Creates a new data source with the indicated changes to the settings.

The new data source will share the same database metadata cache.

WithUser ( object userValue ) : SqlServerDataSource

Creates a new data source with the indicated user.

This is used in conjunction with audit rules.

Protected Methods

Method Description
Execute ( SqlTransaction>.OperationExecutionToken executionToken, SqlTransaction>.OperationImplementation implementation, object state ) : int?

Executes the specified operation.

ExecuteAsync ( SqlParameter>.CommandExecutionToken executionToken, CommandImplementationAsync implementation, CancellationToken cancellationToken, object state ) : Task

Execute the operation asynchronously.

ExecuteAsync ( SqlTransaction>.OperationExecutionToken executionToken, SqlTransaction>.OperationImplementationAsync implementation, CancellationToken cancellationToken, object state ) : Task

Execute the operation asynchronously.

Private Methods

Method Description
BuildConnectionSettingsOverride ( ) : string
CreateConnection ( ) : SqlConnection
CreateConnectionAsync ( CancellationToken cancellationToken = default(CancellationToken) ) : Task

Creates and opens a SQL connection.

The caller of this method is responsible for closing the connection.

Execute ( SqlParameter>.CommandExecutionToken executionToken, CommandImplementation implementation, object state ) : int?
GetEffectiveSettings ( ) : SqlServerEffectiveSettings
GetEffectiveSettingsAsync ( ) : Task
IRootDataSource ( ) : DbConnection
IRootDataSource ( DbConnection connection, DbTransaction transaction ) : IOpenDataSource
IRootDataSource ( ) : ITransactionalDataSource
IRootDataSource ( ) : Task
IRootDataSource ( ) : Task
SqlServerDataSource ( string name, System.Data.SqlClient.SqlConnectionStringBuilder connectionStringBuilder, SqlServerDataSourceSettings settings, SqlServerMetadataCache databaseMetadata, ICacheAdapter cache, object>.ConcurrentDictionary extensionCache ) : System

Method Details

BeginTransaction() public method

Creates a new transaction
the caller of this function is responsible for closing the transaction.
public BeginTransaction ( string transactionName = null, IsolationLevel isolationLevel = null, bool forwardEvents = true ) : SqlServerTransactionalDataSource
transactionName string optional name of the transaction.
isolationLevel IsolationLevel the isolation level. if not supplied, will use the database default.
forwardEvents bool if true, logging events are forwarded to the parent connection.
return SqlServerTransactionalDataSource

BeginTransactionAsync() public method

Creates a new transaction
public BeginTransactionAsync ( string transactionName = null, IsolationLevel isolationLevel = null, bool forwardEvents = true ) : Task
transactionName string Name of the transaction.
isolationLevel IsolationLevel The isolation level.
forwardEvents bool if set to true [forward events].
return Task

CreateFromConfig() public static method

Creates a new connection using the connection string settings in the app.config file.
public static CreateFromConfig ( string connectionName ) : SqlServerDataSource
connectionName string
return SqlServerDataSource

Execute() protected method

Executes the specified operation.
protected Execute ( SqlTransaction>.OperationExecutionToken executionToken, SqlTransaction>.OperationImplementation implementation, object state ) : int?
executionToken SqlTransaction>.OperationExecutionToken The execution token.
implementation SqlTransaction>.OperationImplementation The implementation.
state object The state.
return int?

ExecuteAsync() protected method

Execute the operation asynchronously.
protected ExecuteAsync ( SqlParameter>.CommandExecutionToken executionToken, CommandImplementationAsync implementation, CancellationToken cancellationToken, object state ) : Task
executionToken SqlParameter>.CommandExecutionToken The execution token.
implementation CommandImplementationAsync The implementation that handles processing the result of the command.
cancellationToken System.Threading.CancellationToken The cancellation token.
state object User supplied state.
return Task

ExecuteAsync() protected method

Execute the operation asynchronously.
protected ExecuteAsync ( SqlTransaction>.OperationExecutionToken executionToken, SqlTransaction>.OperationImplementationAsync implementation, CancellationToken cancellationToken, object state ) : Task
executionToken SqlTransaction>.OperationExecutionToken The execution token.
implementation SqlTransaction>.OperationImplementationAsync The implementation.
cancellationToken System.Threading.CancellationToken The cancellation token.
state object The state.
return Task

SqlServerDataSource() public method

Initializes a new instance of the SqlServerDataSource class.
public SqlServerDataSource ( System.Data.SqlClient.SqlConnectionStringBuilder connectionStringBuilder, SqlServerDataSourceSettings settings = null ) : System
connectionStringBuilder System.Data.SqlClient.SqlConnectionStringBuilder The connection string builder.
settings Tortuga.Chain.SqlServer.SqlServerDataSourceSettings Optional settings object.
return System

SqlServerDataSource() public method

Initializes a new instance of the SqlServerDataSource class.
connectionStringBuilder;connectionStringBuilder is null.
public SqlServerDataSource ( string name, System.Data.SqlClient.SqlConnectionStringBuilder connectionStringBuilder, SqlServerDataSourceSettings settings = null ) : System
name string Optional name of the data source.
connectionStringBuilder System.Data.SqlClient.SqlConnectionStringBuilder The connection string builder.
settings Tortuga.Chain.SqlServer.SqlServerDataSourceSettings Optional settings object.
return System

SqlServerDataSource() public method

Initializes a new instance of the SqlServerDataSource class.
connectionString is null or empty.;connectionString
public SqlServerDataSource ( string connectionString, SqlServerDataSourceSettings settings = null ) : System
connectionString string The connection string.
settings Tortuga.Chain.SqlServer.SqlServerDataSourceSettings Optional settings object.
return System

SqlServerDataSource() public method

Initializes a new instance of the SqlServerDataSource class.
connectionString is null or empty.;connectionString
public SqlServerDataSource ( string name, string connectionString, SqlServerDataSourceSettings settings = null ) : System
name string Name of the data source.
connectionString string The connection string.
settings Tortuga.Chain.SqlServer.SqlServerDataSourceSettings Optional settings object.
return System

StartSqlDependency() public method

Starts SQL dependency.
true if the listener initialized successfully; false if a compatible listener already exists.
public StartSqlDependency ( ) : bool
return bool

StopSqlDependency() public method

Stops SQL dependency.
true if the listener was completely stopped; false if the System.AppDomain was unbound from the listener, but there are is at least one other System.AppDomain using the same listener.
public StopSqlDependency ( ) : bool
return bool

TestConnection() public method

Tests the connection.
public TestConnection ( ) : void
return void

TestConnectionAsync() public method

Tests the connection asynchronously.
public TestConnectionAsync ( ) : Task
return Task

WithCache() public method

Craetes a new data source with the provided cache.
public WithCache ( ICacheAdapter cache ) : SqlServerDataSource
cache ICacheAdapter The cache.
return SqlServerDataSource

WithRules() public method

Creates a new data source with additional audit rules.
public WithRules ( ) : SqlServerDataSource
return SqlServerDataSource

WithRules() public method

Creates a new data source with additional audit rules.
public WithRules ( IEnumerable additionalRules ) : SqlServerDataSource
additionalRules IEnumerable The additional rules.
return SqlServerDataSource

WithSettings() public method

Creates a new data source with the indicated changes to the settings.
The new data source will share the same database metadata cache.
public WithSettings ( SqlServerDataSourceSettings settings ) : SqlServerDataSource
settings Tortuga.Chain.SqlServer.SqlServerDataSourceSettings The new settings to use.
return SqlServerDataSource

WithUser() public method

Creates a new data source with the indicated user.
This is used in conjunction with audit rules.
public WithUser ( object userValue ) : SqlServerDataSource
userValue object The user value.
return SqlServerDataSource