public PageLabelsSqliteBackend(IBackendSettingsService backendSettings, IConverter <DbDataReader, IEnumerable <Guid> > toLabelsIdConverter)
        {
            _sqliteStorage = new SqliteDatabase(new SqliteStorageOptions {
                Path = backendSettings.GetSqliteBackendPath()
            });
            _toLabelsIdConverter = toLabelsIdConverter;

            _initTask = CreateTable();
        }
        public LabelSqliteBackend(IBackendSettingsService backendSettings, IConverter <DbDataReader, Label> converter, IConverter <DbDataReader, IList <Label> > toLabelsConverter)
        {
            _toLabelConverter  = converter;
            _toLabelsConverter = toLabelsConverter;
            _sqliteStorage     = new SqliteDatabase(new SqliteStorageOptions {
                Path = backendSettings.GetSqliteBackendPath()
            });

            _initTask = CreateTable();
        }
Example #3
0
        public SqliteStorageTest()
        {
            DataFixture = new Fixture();
            DataFixture.Register(ObjectId.GenerateNewId);

            SqliteStorage = new SqliteStorage <DummyTestClass>(customTypes: new Dictionary <Type, (Func <object, string> serializer, Func <string, object> deserializer)>()
            {
                // add support for custom type
                { typeof(ObjectId), (obj => obj.ToString(), str => ObjectId.Parse(str)) }
            });

            // delete table
            SqliteStorage.DeleteTable();

            // re-create the table
            SqliteStorage.CreateTable();

            // clean-up, delete all models
            Dispose();
        }
 public PageSqliteBackend(ISqliteStorage sqliteStorage)
 {
     _sqliteStorage = sqliteStorage;
 }