public ThingRepository(string collectionName, IConfiguration config, IDateContext dateContext, IUserContext userContext) : base(collectionName, config, dateContext, userContext) { // Collection.Indexes.CreateOne( Builders <Thing> .IndexKeys.Ascending(cp => cp.Name), new CreateIndexOptions { Name = "name_u", Unique = true }); }
public MongoRepository( string collectionName, IConfiguration config, IDateContext dateContext, IUserContext userContext) { _dateContext = dateContext; _userContext = userContext; var url = MongoUrl.Create(config.Get <string>("Data:App:ConnectionString")); Database = new MongoClient(url).GetDatabase(url.DatabaseName); Collection = Database.GetCollection <T>(collectionName); // Version index for quickly determining the latest version Collection.Indexes.CreateOne(Builders <T> .IndexKeys.Descending(t => t.Version)); Collection.Indexes.CreateOne(Builders <T> .IndexKeys.Ascending(t => t.Created)); Collection.Indexes.CreateOne(Builders <T> .IndexKeys.Ascending(t => t.CreatedBy)); Collection.Indexes.CreateOne(Builders <T> .IndexKeys.Descending(t => t.CreatedBy)); Collection.Indexes.CreateOne(Builders <T> .IndexKeys.Ascending(t => t.Updated)); Collection.Indexes.CreateOne(Builders <T> .IndexKeys.Ascending(t => t.UpdatedBy)); Collection.Indexes.CreateOne(Builders <T> .IndexKeys.Descending(t => t.UpdatedBy)); }
public ThingRepository(IConfiguration config, IDateContext dateContext, IUserContext userContext) : base(config, dateContext, userContext) { }
public MongoRepository( IConfiguration config, IDateContext dateContext, IUserContext userContext) : this(typeof(T).Name, config, dateContext, userContext) { }
public StatusRepository(string collectionName, IConfiguration config, IDateContext dateContext, IUserContext userContext) : base(collectionName, config, dateContext, userContext) { Init(); }
public StatusRepository(IConfiguration config, IDateContext dateContext, IUserContext userContext) : base(config, dateContext, userContext) { Init(); }