public ConfigSvcBase() { var dir = ConfigConst.PRE_CONFIG_DIR.toPath(); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var connectionString = new LiteDB.ConnectionString($"{ConfigConst.PRE_CONFIG_DIR}/{ConfigConst.CONFIG_DB_FILE_NAME}") { Connection = ConnectionType.Shared }; if (this.LiteDatabase.isNull()) { this.LiteDatabase = new LiteDatabase(connectionString); } if (this.Collection.isNull()) { this.Collection = LiteDatabase.GetCollection(ConfigConst.DB_NAME); } }
/// <summary> /// Initializes a new instance of the <see cref="LiteDbConnectionManager"/> class. /// </summary> /// <param name="connectionInformation">The connection information.</param> /// <param name="scope">The scope.</param> public LiteDbConnectionManager(IConnectionInformation connectionInformation, ICreationScope scope) { Guard.NotNull(() => connectionInformation, connectionInformation); Guard.NotNull(() => scope, scope); _connectionInformation = connectionInformation; var builder = new LiteDB.ConnectionString(_connectionInformation.ConnectionString); _shared = builder.Connection == ConnectionType.Shared; var existingScopeConnection = scope.GetDisposable <LiteDbConnectionManager>(); if (existingScopeConnection != null) { _db = existingScopeConnection.GetDatabase().Database; _shouldDisposeDirectConnection = false; } else { _shouldDisposeDirectConnection = true; } }
public static LiteException FileSizeExceeds(long limit) { return(new LiteException(105, "Database size exceeds limit of {0}", ConnectionString.FormatFileSize(limit))); }
public RecoveryService(ConnectionString connectionString) { _connectionString = connectionString; }
/// <summary> /// Starts LiteDB database using a connection string for file system database /// </summary> public LiteRepository(ConnectionString connectionString, BsonMapper mapper = null) { _db = new LiteDB.LiteDatabase(connectionString, mapper); }
public JournalService(ConnectionString connectionString, CacheService cache) { _connectionString = connectionString; _cache = cache; }