This allows overriding connection options.
Inheritance: Tortuga.Chain.DataSources.DataSourceSettings
        /// <summary>
        /// Initializes a new instance of the <see cref="OleDbSqlServerDataSource" /> class.
        /// </summary>
        /// <param name="name">Name of the data source.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="settings">Optional settings object.</param>
        /// <exception cref="ArgumentException">connectionString is null or empty.;connectionString</exception>
        public OleDbSqlServerDataSource(string name, string connectionString, SqlServerDataSourceSettings settings = null) : base(settings)
        {
            if (string.IsNullOrEmpty(connectionString))
                throw new ArgumentException("connectionString is null or empty.", "connectionString");

            m_ConnectionBuilder = new OleDbConnectionStringBuilder(connectionString);
            if (string.IsNullOrEmpty(name))
                Name = m_ConnectionBuilder.DataSource;
            else
                Name = name;

            m_DatabaseMetadata = new OleDbSqlServerMetadataCache(m_ConnectionBuilder);

            if (settings != null)
            {
                XactAbort = settings.XactAbort;
                ArithAbort = settings.ArithAbort;
            }

            m_ExtensionCache = new ConcurrentDictionary<Type, object>();
            m_Cache = DefaultCache;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlServerDataSourceBase"/> class.
 /// </summary>
 /// <param name="settings">Optional settings value.</param>
 protected SqlServerDataSourceBase(SqlServerDataSourceSettings settings) : base(settings)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SqlServerDataSource" /> class.
 /// </summary>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="settings">Optional settings object.</param>
 /// <exception cref="ArgumentException">connectionString is null or empty.;connectionString</exception>
 public OleDbSqlServerDataSource(string connectionString, SqlServerDataSourceSettings settings = null)
     : this(null, connectionString, settings)
 {
 }
        /// <summary>
        /// Creates a new data source with the indicated changes to the settings.
        /// </summary>
        /// <param name="settings">The new settings to use.</param>
        /// <returns></returns>
        /// <remarks>The new data source will share the same database metadata cache.</remarks>
        public OleDbSqlServerDataSource WithSettings(SqlServerDataSourceSettings settings)
        {
            var mergedSettings = new SqlServerDataSourceSettings()
            {
                DefaultCommandTimeout = settings?.DefaultCommandTimeout ?? DefaultCommandTimeout,
                SuppressGlobalEvents = settings?.SuppressGlobalEvents ?? SuppressGlobalEvents,
                StrictMode = settings?.StrictMode ?? StrictMode,
                XactAbort = settings?.XactAbort ?? XactAbort,
                ArithAbort = settings?.ArithAbort ?? ArithAbort
            };
            var result = new OleDbSqlServerDataSource(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;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OleDbSqlServerDataSource"/> class.
 /// </summary>
 /// <param name="connectionStringBuilder">The connection string builder.</param>
 /// <param name="settings">Optional settings object.</param>
 public OleDbSqlServerDataSource(OleDbConnectionStringBuilder connectionStringBuilder, SqlServerDataSourceSettings settings = null)
     : this(null, connectionStringBuilder, settings)
 {
 }
        private OleDbSqlServerDataSource(string name, OleDbConnectionStringBuilder connectionStringBuilder, SqlServerDataSourceSettings settings, OleDbSqlServerMetadataCache databaseMetadata, ICacheAdapter cache, ConcurrentDictionary<Type, object> extensionCache) : base(settings)
        {
            if (connectionStringBuilder == null)
                throw new ArgumentNullException("connectionStringBuilder", "connectionStringBuilder is null.");

            m_ConnectionBuilder = connectionStringBuilder;
            if (string.IsNullOrEmpty(name))
                Name = m_ConnectionBuilder.DataSource;
            else
                Name = name;

            m_DatabaseMetadata = databaseMetadata;

            if (settings != null)
            {
                XactAbort = settings.XactAbort;
                ArithAbort = settings.ArithAbort;
            }
            m_ExtensionCache = extensionCache;
            m_Cache = cache;
        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlServerDataSource" /> class.
        /// </summary>
        /// <param name="name">Optional name of the data source.</param>
        /// <param name="connectionStringBuilder">The connection string builder.</param>
        /// <param name="settings">Optional settings object.</param>
        /// <exception cref="ArgumentNullException">connectionStringBuilder;connectionStringBuilder is null.</exception>
        public SqlServerDataSource(string name, SqlConnectionStringBuilder connectionStringBuilder, SqlServerDataSourceSettings settings = null) : base(settings)
        {
            if (connectionStringBuilder == null)
                throw new ArgumentNullException("connectionStringBuilder", "connectionStringBuilder is null.");

            m_ConnectionBuilder = connectionStringBuilder;
            if (string.IsNullOrEmpty(name))
                Name = m_ConnectionBuilder.InitialCatalog ?? m_ConnectionBuilder.DataSource;
            else
                Name = name;

            m_DatabaseMetadata = new SqlServerMetadataCache(m_ConnectionBuilder);

            if (settings != null)
            {
                XactAbort = settings.XactAbort;
                ArithAbort = settings.ArithAbort;
            }
            m_ExtensionCache = new ConcurrentDictionary<Type, object>();
            m_Cache = DefaultCache;
        }