Exemplo n.º 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));
 }
Exemplo n.º 2
0
        public virtual ISQLiteConnection CreateTemp()
        {
            var options = new SQLiteConnectionOptions {
                Type = SQLiteConnectionOptions.DatabaseType.Temporary,
            };

            return(CreateEx(options));
        }
Exemplo n.º 3
0
        public virtual ISQLiteConnection CreateInMemory()
        {
            var options = new SQLiteConnectionOptions {
                Type = SQLiteConnectionOptions.DatabaseType.InMemory,
            };

            return(CreateEx(options));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 6
0
 private ISQLiteConnection CreateTempDb(SQLiteConnectionOptions options)
 {
     return(CreateSQLiteConnection(string.Empty, options.StoreDateTimeAsTicks));
 }
Exemplo n.º 7
0
 private ISQLiteConnection CreateInMemoryDb(SQLiteConnectionOptions options)
 {
     return(CreateSQLiteConnection(InMemoryDatabase, options.StoreDateTimeAsTicks));
 }