protected EntityCollectionDefinition(IMongoConnectionHandler connectionHandler) { if (connectionHandler == null) { throw new ArgumentNullException("connectionHandler"); } Collection = connectionHandler.Database.GetCollection <T>(typeof(T).Name.ToLower() + "s"); // setup serialization if (!BsonClassMap.IsClassMapRegistered(typeof(Entity))) { try { BsonClassMap.RegisterClassMap <Entity>( cm => { cm.AutoMap(); cm.SetIdMember(cm.GetMemberMap(i => i.Id)); cm.IdMemberMap.SetIdGenerator(StringObjectIdGenerator.Instance); }); } catch (ArgumentException) { // this fails with an argument exception at startup, but otherwise works fine. Probably should try to figure out why, but ignoring it is easier :( } } }
public InfoController(IMemberRepository memberRepository, IMongoConnectionHandler mongoConnectionHandler, ICommentRepository commentRepository, IInfoRepository infoRepository) { _memberRepo = memberRepository; _commentRepo = commentRepository; _infoRepo = infoRepository; _mongoConnectionHandler = mongoConnectionHandler; }
public TapCollectionDefinition(IMongoConnectionHandler connectionHandler) : base(connectionHandler) { if (!BsonClassMap.IsClassMapRegistered(typeof(Tap))) { BsonClassMap.RegisterClassMap <Tap>( cm => { cm.AutoMap(); }); } }
public MeetingInfoValuesCollectionDefinition(IMongoConnectionHandler connectionHandler) : base(connectionHandler) { if (!BsonClassMap.IsClassMapRegistered(typeof(MeetingInfoValues))) { BsonClassMap.RegisterClassMap <MeetingInfoValues>( cm => { cm.AutoMap(); }); } }
public SecurityRequestCollectionDefinition(IMongoConnectionHandler connectionHandler) : base(connectionHandler) { if (!BsonClassMap.IsClassMapRegistered(typeof(SecurityRequest))) { BsonClassMap.RegisterClassMap <SecurityRequest>( cm => { cm.AutoMap(); }); } }
public StoredEventCollectionDefinition(IMongoConnectionHandler connectionHandler) : base(connectionHandler) { if (!BsonClassMap.IsClassMapRegistered(typeof(StoredEvent))) { BsonClassMap.RegisterClassMap <StoredEvent>( cm => { cm.AutoMap(); }); } }
public UserCollectionDefinition(IMongoConnectionHandler connectionHandler) : base(connectionHandler) { if (!BsonClassMap.IsClassMapRegistered(typeof(User))) { BsonClassMap.RegisterClassMap <User>( cm => { cm.AutoMap(); cm.MapField("_roleIds").SetElementName("RoleIds"); }); } Collection.EnsureIndex(new IndexKeysBuilder().Ascending("Username")); }
public SecurityRequestCollectionDefinition(IMongoConnectionHandler connectionHandler) : base(connectionHandler) { if (!BsonClassMap.IsClassMapRegistered(typeof(SecurityRequest))) { try { BsonClassMap.RegisterClassMap <SecurityRequest>( cm => { cm.AutoMap(); }); } catch (ArgumentException) { // this fails with an argument exception at startup, but otherwise works fine. Probably should try to figure out why, but ignoring it is easier :( } } }
protected EntityCollectionDefinition(IMongoConnectionHandler connectionHandler) { if (connectionHandler == null) { throw new ArgumentNullException("connectionHandler"); } Collection = connectionHandler.Database.GetCollection <T>(typeof(T).Name.ToLower() + "s"); // setup serialization if (!BsonClassMap.IsClassMapRegistered(typeof(Entity))) { BsonClassMap.RegisterClassMap <Entity>( cm => { cm.AutoMap(); cm.SetIdMember(cm.GetMemberMap(c => c.Id)); cm.IdMemberMap.SetIdGenerator(StringObjectIdGenerator.Instance); }); } }