The documentation comes from the Markdown files in the source code, so is always up-to-date but available only in English. Enjoy!
A Connector in Signum Framework is a connection factory that encapsulates the Schema and the connectionString required to access a specific database. The connector is typically configured globally for the application, but can be temporarily overridden for the current thread within a region of code. This enables flexible database access and transaction management, while keeping configuration centralized and consistent.
The connector also holds a Version property (such as SqlServerVersion or PostgresVersion) that determines which features the underlying RDBMS supports. This allows Signum to adapt its behavior and enable or disable features based on the database version.
Most operations in Signum use the globally configured connector, but you can override it for advanced scenarios such as multi-database loading, or testing. The override is thread-local and scoped, ensuring that changes do not affect other threads or requests.
For ecample Database and Administrator are static classes used to save, retrieve, and query objects, without needing to know the database structure (Schema) or physical location (connection string).
If you need to change the connection for a block of code, use Connector.Override.
The Connector base class defines common properties and methods for all database connectors:
Schema: The database schema.ConnectionString: The connection string for the database.Version: The database version, used to determine feature support.CommandTimeout: Optional default timeout for commands.ParameterBuilder: Abstract property for creating database parameters.IsolationLevel: Transaction isolation level.SqlBuilder: SQL builder for the current connector.Implements Microsoft SQL Server support:
SqlServerVersion.Implements PostgreSQL support:
PostgresVersion.Set the main connector:
Connector.Default = new SqlServerConnector(connectionString, schema, version);
// or
Connector.Default = new PostgreSqlConnector(connectionString, schema, version);Temporarily override the connector:
using (Connector.Override(newConnector))
{
// Code using newConnector
}Override the command timeout:
using (Connector.CommandTimeoutScope(3 * 60)) // 3 minutes
{
// Slow query here
}public static Connector Default { get; set; }public static Connector Current { get; }public static IDisposable Override(Connector connector)public static IDisposable CommandTimeoutScope(int? timeoutSeconds)public Schema Schema { get; }public IsolationLevel IsolationLevel { get; set; }public string ConnectionString { get; protected set; }public int? CommandTimeout { get; set; }public abstract ParameterBuilder ParameterBuilder { get; protected set; }public Version Version { get; } // or SqlServerVersion/PostgresVersion in derived classesSee Connector.cs, SqlServerConnector.cs, and PostgreSqlConnector.cs for more details.
© Signum Software. All Rights Reserved.
Powered by Signum Framework