Ejemplo n.º 1
0
 public override void Initialize()
 {
     DataBase = new LiteDatabase(ConnectionString);
     LCol     = DataBase.GetCollection <CacheItem>(CollectionName);
     LCol.EnsureIndex(c => c.Key);
     //CurrentCollectionCount = LCol.Count();
 }
Ejemplo n.º 2
0
        public void Dispose()
        {
            if (this.Database != null)
            {
                this.Database.Dispose();
            }

            this.Mods        = null;
            this.ModVersions = null;
        }
Ejemplo n.º 3
0
        public ModStorage(string version, IDomain domain)
        {
            string fullPath = Path.Combine(Settings.ModifiDirectory, version + ".db");

            this.Database = new LiteDB.LiteDatabase(fullPath);

            this.Mods        = Database.GetCollection <ModMetadata>(domain.GetDomainIdentifier() + "-meta");
            this.ModVersions = Database.GetCollection <ModVersion>(domain.GetDomainIdentifier() + "-versions");

            this.Domain = domain;
        }
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 public LiteDBTable([NotNull] IPrincipalKeyValueFactory <TKey> keyValueFactory, bool sensitiveLoggingEnabled, LiteDatabase _liteDatabase, IEntityType entityType)
 {
     _keyValueFactory         = keyValueFactory;
     _sensitiveLoggingEnabled = sensitiveLoggingEnabled;
     _docrows = _liteDatabase.GetCollection <BsonDocument>(entityType.TableName());
     entityType.GetKeys()?.ToList().ForEach(key =>
     {
         key.Properties.ToList().ForEach(ip =>
         {
             _docrows.EnsureIndex(ip.Name, ip.IsForeignKey());
         });
     });
     _entityType = entityType;
 }