Пример #1
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 empty.;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 empty.", nameof(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;

        if (settings != null)
        {
            EnforceForeignKeys = settings.EnforceForeignKeys;
        }
    }
Пример #2
0
    SQLiteDataSource(string?name, SQLiteConnectionStringBuilder connectionStringBuilder, SQLiteDataSourceSettings settings, SQLiteMetadataCache databaseMetadata, ICacheAdapter cache, ConcurrentDictionary <Type, object> extensionCache) : base(settings)
    {
        if (connectionStringBuilder == null)
        {
            throw new ArgumentNullException(nameof(connectionStringBuilder), $"{nameof(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;

        if (settings != null)
        {
            EnforceForeignKeys = settings.EnforceForeignKeys;
        }
    }
Пример #3
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;
        }
Пример #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="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;
        }
Пример #5
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(nameof(connectionStringBuilder), $"{nameof(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;
    }
Пример #6
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;
        }
Пример #7
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;
        }