/// <summary>
        /// Initializes a new instance of the <see cref="LocklessSQLiteStore"/> class.
        /// </summary>
        /// <param name="persistenceConfig">The persistence configuration.</param>
        public LocklessSQLiteStore(IPersistenceConfig persistenceConfig)
        {
            Contracts.Requires.That(persistenceConfig != null);

            this.connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(
                                                            SQLitePlatform.New(), new SQLiteConnectionString(persistenceConfig.DatabasePath, false)));
        }
        public SQLiteStoreMigrator(IPersistenceConfig persistenceConfig, params Type[] entityTypes)
        {
            Contracts.Requires.That(persistenceConfig != null);
            Contracts.Requires.That(entityTypes.AllAndSelfNotNull());

            this.databasePath = persistenceConfig.DatabasePath;
            this.entityTypes  = entityTypes;
        }
Exemple #3
0
        /// <inheritdoc />
        public async Task <IAsyncStore <TEntity> > CreateStoreAsync <TEntity>(
            IPersistenceConfig config, CancellationToken cancellation = default(CancellationToken))
            where TEntity : class
        {
            IAsyncStoreFactoryContracts.CreateStoreAsync(config);

            cancellation.ThrowIfCancellationRequested();
            var migrator = new SQLiteStoreMigrator(config, typeof(TEntity));
            await migrator.MigrateAsync(cancellation).DontMarshallContext();

            cancellation.ThrowIfCancellationRequested();
            return(this.addLocks ?
                   SQLiteStore.Locked.ForEntity <TEntity> .NoMigration.New(config) :
                   SQLiteStore.Lockless.ForEntity <TEntity> .NoMigration.New(config));
        }
Exemple #4
0
 public static void CreateStoreAsync(IPersistenceConfig config)
 {
     Contracts.Requires.That(config != null);
 }
Exemple #5
0
 public static ITransactionalStore <TEntity> New(IPersistenceConfig config) =>
 new TypedTransactionalStore <TEntity>(new LocklessSQLiteStore(config));
Exemple #6
0
 public static MigratedTransactionalStore <TEntity> New(IPersistenceConfig config) =>
 new MigratedTransactionalStore <TEntity>(
     new SQLiteStoreMigrator(config, typeof(TEntity)),
     new LocklessSQLiteStore(config));
Exemple #7
0
 public static ITransactionalStore New(IPersistenceConfig config) => new LocklessSQLiteStore(config);
 /// <summary>
 /// Initializes a new instance of the <see cref="LockedSQLiteStore"/> class.
 /// </summary>
 /// <param name="persistenceConfig">The persistence configuration.</param>
 public LockedSQLiteStore(IPersistenceConfig persistenceConfig)
     : base(new LocklessSQLiteStore(persistenceConfig))
 {
 }
 public SQLiteStoreMigrator(IPersistenceConfig persistenceConfig, IEnumerable <Type> entityTypes)
     : this(persistenceConfig, entityTypes?.ToArray())
 {
 }