Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public Repository(ISessionProvider sessionProvider)
 {
     _collection = sessionProvider.GetCollection <T>();
 }