Tortuga.Chain.SQLiteDataSource.WithSettings C# (CSharp) Method

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 ( SQLiteDataSourceSettings settings ) : SQLiteDataSource
settings Tortuga.Chain.SQLite.SQLiteDataSourceSettings The new settings to use.
return SQLiteDataSource
        public SQLiteDataSource WithSettings(SQLiteDataSourceSettings settings)
        {
            var mergedSettings = new SQLiteDataSourceSettings()
            {
                DefaultCommandTimeout = settings?.DefaultCommandTimeout ?? DefaultCommandTimeout,
                SuppressGlobalEvents = settings?.SuppressGlobalEvents ?? SuppressGlobalEvents,
                StrictMode = settings?.StrictMode ?? StrictMode,
                DisableLocks = settings?.DisableLocks ?? DisableLocks,
            };
            var result = new SQLiteDataSource(Name, m_ConnectionBuilder, mergedSettings, m_DatabaseMetadata, m_Cache, m_ExtensionCache);
            result.m_DatabaseMetadata = m_DatabaseMetadata;
            result.AuditRules = AuditRules;
            result.UserValue = UserValue;

            result.ExecutionStarted += (sender, e) => OnExecutionStarted(e);
            result.ExecutionFinished += (sender, e) => OnExecutionFinished(e);
            result.ExecutionError += (sender, e) => OnExecutionError(e);
            result.ExecutionCanceled += (sender, e) => OnExecutionCanceled(e);

            return result;
        }

Usage Example

Ejemplo n.º 1
0
        static TestBase()
        {
            s_DataSource = new SQLiteDataSource("Data Source=SQLiteTestDatabase.sqlite;");
            s_StrictDataSource = s_DataSource.WithSettings(new SQLiteDataSourceSettings() { StrictMode = true });

        }
All Usage Examples Of Tortuga.Chain.SQLiteDataSource::WithSettings