Пример #1
0
 public override void Initialize()
 {
     DataBase = new LiteDatabase(ConnectionString);
     LCol     = DataBase.GetCollection <CacheItem>(CollectionName);
     LCol.EnsureIndex(c => c.Key);
     //CurrentCollectionCount = LCol.Count();
 }
 /// <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;
 }