コード例 #1
0
 public virtual ISQLiteConnection CreateEx(string address, string key = null, SQLiteConnectionOptions options = null)
 {
     options         = options ?? new SQLiteConnectionOptions();
     options.Address = address;
     options.Key     = key;
     return(CreateEx(options));
 }
コード例 #2
0
        public virtual ISQLiteConnection CreateTemp()
        {
            var options = new SQLiteConnectionOptions {
                Type = SQLiteConnectionOptions.DatabaseType.Temporary,
            };

            return(CreateEx(options));
        }
コード例 #3
0
        public virtual ISQLiteConnection CreateInMemory()
        {
            var options = new SQLiteConnectionOptions {
                Type = SQLiteConnectionOptions.DatabaseType.InMemory,
            };

            return(CreateEx(options));
        }
コード例 #4
0
        private ISQLiteConnection CreateFileDb(SQLiteConnectionOptions options)
        {
            if (string.IsNullOrWhiteSpace(options.Address))
            {
                throw new ArgumentException(Properties.Resources.CreateFileDbInvalidAddress);
            }
            var    path     = options.BasePath ?? GetDefaultBasePath();
            string filePath = LocalPathCombine(path, options.Address);

            return(CreateSQLiteConnection(filePath, options.StoreDateTimeAsTicks));
        }
コード例 #5
0
        public virtual ISQLiteConnection CreateEx(SQLiteConnectionOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            switch (options.Type)
            {
            case SQLiteConnectionOptions.DatabaseType.InMemory:
                return(CreateInMemoryDb(options));

            case SQLiteConnectionOptions.DatabaseType.Temporary:
                return(CreateTempDb(options));

            default:
                return(CreateFileDb(options));
            }
        }
コード例 #6
0
 private ISQLiteConnection CreateTempDb(SQLiteConnectionOptions options)
 {
     return(CreateSQLiteConnection(string.Empty, options.StoreDateTimeAsTicks));
 }
コード例 #7
0
 private ISQLiteConnection CreateInMemoryDb(SQLiteConnectionOptions options)
 {
     return(CreateSQLiteConnection(InMemoryDatabase, options.StoreDateTimeAsTicks));
 }