Example #1
0
        public UserStorage(MongoDataProvider dataProvider)
        {
            this.dataProvider = dataProvider;

            var options = new CreateIndexOptions()
            {
                Unique = true
            };
            var field           = new StringFieldDefinition <User>("Login");
            var indexDefinition = new IndexKeysDefinitionBuilder <User>().Ascending(field);

            this.dataProvider.AuthDb.GetCollection <User>("users").Indexes.CreateOne(indexDefinition, options);
        }
Example #2
0
        public SvcTokenStorage(MongoDataProvider dataProvider)
        {
            this.dataProvider = dataProvider;

            var options = new CreateIndexOptions()
            {
                Unique = true
            };
            var field           = new StringFieldDefinition <SvcToken>("SvcId");
            var indexDefinition = new IndexKeysDefinitionBuilder <SvcToken>().Ascending(field);

            this.dataProvider.AuthDb.GetCollection <SvcToken>("svctokens").Indexes.CreateOne(indexDefinition, options);
        }