public static async Task CreateConstraints(ISessionProvider sessionProvider) { //User constraints var users = sessionProvider.GetCollection <User>(); await users.Indexes.DropAllAsync(); await users.AddUniqueIndex(_ => _.Email); //Project constraints var projects = sessionProvider.GetCollection <Project>(); await projects.Indexes.DropAllAsync(); await projects.AddUniqueIndex(_ => _.Name); }
public Repository(ISessionProvider sessionProvider) { _collection = sessionProvider.GetCollection <T>(); }