This class is used to modify settings that are not represented by the connection string.
Inheritance: Tortuga.Chain.DataSources.DataSourceSettings
示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteDataSourceBase"/> class.
 /// </summary>
 /// <param name="settings">Optional settings object.</param>
 protected SQLiteDataSourceBase(SQLiteDataSourceSettings settings) : base(settings)
 {
     if (settings != null)
     {
         DisableLocks = settings.DisableLocks ?? false;
     }
 }
示例#2
0
        private SQLiteDataSource(string name, SQLiteConnectionStringBuilder connectionStringBuilder, SQLiteDataSourceSettings settings, SQLiteMetadataCache 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;
            m_ExtensionCache = extensionCache;
            m_Cache = cache;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SQLiteDataSource" /> class.
        /// </summary>
        /// <param name="name">The name of the data source.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="settings">Optional settings object.</param>
        /// <exception cref="ArgumentException">Connection string is null or emtpy.;connectionString</exception>
        public SQLiteDataSource(string name, string connectionString, SQLiteDataSourceSettings settings = null) : base(settings)
        {
            if (string.IsNullOrEmpty(connectionString))
                throw new ArgumentException("Connection string is null or emtpy.", "connectionString");

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

            m_DatabaseMetadata = new SQLiteMetadataCache(m_ConnectionBuilder);
            m_ExtensionCache = new ConcurrentDictionary<Type, object>();
            m_Cache = DefaultCache;
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SQLiteDataSource" /> class.
        /// </summary>
        /// <param name="name">The 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 SQLiteDataSource(string name, SQLiteConnectionStringBuilder connectionStringBuilder, SQLiteDataSourceSettings settings = null) : 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 = new SQLiteMetadataCache(m_ConnectionBuilder);
            m_ExtensionCache = new ConcurrentDictionary<Type, object>();
            m_Cache = DefaultCache;
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteDataSource" /> class.
 /// </summary>
 /// <param name="connectionString"></param>
 /// <param name="settings">Optional settings object.</param>
 public SQLiteDataSource(string connectionString, SQLiteDataSourceSettings settings = null)
     : this(null, connectionString, settings)
 {
 }
示例#6
0
        /// <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 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;
        }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteDataSource" /> class.
 /// </summary>
 /// <param name="connectionStringBuilder"></param>
 /// <param name="settings">Optional settings object.</param>
 public SQLiteDataSource(SQLiteConnectionStringBuilder connectionStringBuilder, SQLiteDataSourceSettings settings = null)
  : this(null, connectionStringBuilder, settings)
 {
 }