Class AdoConnectorConfiguration
- Namespace
- Datafication.Connectors.AdoConnector
- Assembly
- Datafication.AdoConnector.dll
Represents a configuration class for the ADO connector.
public class AdoConnectorConfiguration : IDataConnectorConfiguration
- Inheritance
-
objectAdoConnectorConfiguration
- Implements
Remarks
The configuration provides necessary properties for connecting to a database and executing queries using ADO.NET. Connections and commands are automatically created and managed by the connector.
Constructors
AdoConnectorConfiguration()
Initializes a new instance of the AdoConnectorConfiguration class.
public AdoConnectorConfiguration()
Properties
CommandText
Gets or sets the SQL command text or stored procedure name to execute.
public string CommandText { get; set; }
Property Value
- string
Remarks
This can be a SELECT statement, stored procedure name, or other SQL command. Use the CommandType property to specify whether this is text or a stored procedure.
CommandTimeout
Gets or sets the command timeout in seconds.
public int CommandTimeout { get; set; }
Property Value
- int
Remarks
Specifies the wait time before terminating the command execution and generating an error. Default is 30 seconds.
CommandType
Gets or sets the type of command to execute.
public CommandType CommandType { get; set; }
Property Value
- CommandType
Remarks
Use CommandType.Text for SQL queries (default) or CommandType.StoredProcedure for stored procedures.
ConnectionString
Gets or sets the database connection string.
public string ConnectionString { get; set; }
Property Value
- string
Remarks
The connection string format depends on the provider being used. The connector will automatically create, open, and dispose of the connection.
ErrorHandler
Gets or sets the error handler for managing exceptions.
public Action<Exception>? ErrorHandler { get; set; }
Property Value
- Action<Exception>
Remarks
This provides a means to globally handle exceptions without having to handle them individually on each call. If the handler is not set, exceptions will propagate as usual.
Id
Gets or sets the unique identifier for this configuration.
public string Id { get; set; }
Property Value
- string
Remarks
This identifier can be useful for distinguishing between multiple connector configurations, if needed.
Parameters
Gets or sets the parameters to pass to the command.
public Dictionary<string, object>? Parameters { get; set; }
Property Value
- Dictionary<string, object>
Remarks
Parameter names should include the provider-specific prefix (e.g., "@ParamName" for SQL Server, ":ParamName" for Oracle). Values will be automatically converted to DbParameter objects.
ProviderName
Gets or sets the ADO.NET provider name.
public string ProviderName { get; set; }
Property Value
- string
Remarks
Examples: "System.Data.SQLite", "Microsoft.Data.SqlClient", "Npgsql", "MySql.Data.MySqlClient" The provider assembly must be referenced and registered in your application.