public LoggingDBServices(IMongoSettings settings) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); _logs = database.GetCollection <RequestLogs>("Request_Logs"); }
public MongoRepository(IMongoSettings settings) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); Categories = database.GetCollection <Category>(settings.CollectionName); }
//private readonly IMongoCollection<Mover> _moversService; public SocietiesService(IMongoSettings mongoSettings) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _societiesService = database.GetCollection <Society>(mongoSettings.SocietiesCollectionName); }
public FilesService(IMongoSettings mongoSettings) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _gridFS = new GridFSBucket(database); }
public NtfReferentsService(IMongoSettings mongoSettings) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _ntfReferents = database.GetCollection <NtfReferent>("ntf_referents"); }
public MongoCommentsRepository(IMongoSettings settings) { var mongoClient = new MongoClient(settings.Server); var db = mongoClient.GetDatabase(settings.Database); _commentsCollection = db.GetCollection <Comment>("comments"); }
public MongoStorage(IMongoSettings settings) { var mongoDataBaseName = settings.GetMongoDataBaseName(); var mongoClientSettings = new MongoClientSettings { Servers = settings.GetMongoServers(), WriteConcern = WriteConcern.W1, ReadPreference = ReadPreference.Primary, GuidRepresentation = GuidRepresentation.Standard }; var mongoReplicaSetName = settings.GetMongoReplicaSetName(); if (!string.IsNullOrEmpty(mongoReplicaSetName)) { mongoClientSettings.ReplicaSetName = mongoReplicaSetName; } var mongoUserName = settings.GetMongoUserName(); if (!string.IsNullOrEmpty(mongoUserName)) { mongoClientSettings.Credentials = new[] { MongoCredential.CreateCredential(mongoDataBaseName, mongoUserName, settings.GetMongoPassword()) }; } var client = new MongoClient(mongoClientSettings); database = client.GetDatabase(mongoDataBaseName); }
public RoomListConfigRepository(IMongoSettings settings) { _settings = settings; _client = new MongoClient(_settings.ConnectionString); _db = _client.GetDatabase(_settings.DatabaseName); _dbCol = _db.GetCollection <RoomListConfig>(typeof(RoomListConfig).Name); }
public MongoService(IMongoSettings settings) { if (settings?.ConnectionString != null) { client = new MongoClient(settings.ConnectionString); database = client.GetDatabase(settings.DatabaseName); } }
public CategoryService(IMapper mapper, IMongoSettings mongoSettings) { var client = new MongoClient(mongoSettings.ConnectionString); var database = client.GetDatabase(mongoSettings.DatabaseName); _categoryCollection = database.GetCollection <Category>(mongoSettings.CategoryCollectionName); _mapper = mapper; }
/// <summary> /// Init the mongo client and database /// @TODO: build specific settings class instead of passing everything /// </summary> /// <param name="settings">The mongo settings file</param> /// <param name="baseCollection">The service collection context</param> public virtual void Init(IMongoSettings settings, string baseCollection) { var client = new MongoClient(settings.ConnectionString); this.Database = client.GetDatabase(settings.DatabaseName); Collection = Database.GetCollection <TModel>(baseCollection); }
public ExchangeRatesMongoRepository(IMongoSettings settings, IMapper mapper) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); m_ExchangeRates = database.GetCollection <ExchangeRatesPairForMongo>(settings.ExchangeRatesCollectionName); m_Mapper = mapper ?? throw new ArgumentException(nameof(mapper)); }
public ClientsService(IMongoSettings mongoSettings) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _clients = database.GetCollection <Client>(mongoSettings.ClientsCollectionName); _users = database.GetCollection <User>(mongoSettings.UsersCollectionName); }
public PersonRepository(IMongoSettings mongoSettings) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var collection = mongoClient.GetDatabase("PersonAPI").GetCollection <Person>("Person"); this.PersonCollection = collection; }
public HousingsService(IMongoSettings mongoSettings) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _housings = database.GetCollection <Housing>(mongoSettings.HousingsCollectionName); _moveRequests = database.GetCollection <MoveRequest>(mongoSettings.MoveRequestsCollectionName); }
public AccountContext(IMongoSettings settings) : base(settings) { AccountInfos = base._database.GetCollection <AccountInfo>(typeof(AccountInfo).Name); GenInfos = base._database.GetCollection <UserIdGenInfo>(typeof(UserIdGenInfo).Name); LevelInfos = base._database.GetCollection <LevelInfo>(typeof(LevelInfo).Name); LevelInfos = base._database.GetCollection <LevelInfo>(typeof(LevelInfo).Name); GameInfos = base._database.GetCollection <GameInfo>(typeof(GameInfo).Name); }
public FormsService(IMongoSettings mongoSettings) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _forms = database.GetCollection <BuildupForm>("forms"); _formsQAs = database.GetCollection <BuildupFormQA>("forms_qa"); }
public MongoBackup(IMongoSettings settings, ITasksRepository repository) { _repository = repository; var client = new MongoClient(settings.MongoConnectionString); var database = client.GetDatabase(settings.MongoDbName); _tasksCollection = database.GetCollection <Models.Task>(TASK_COLLECTION); }
public ProductTypeRepository(IMongoSettings settings, ILoggerManager logger, MongoContext context, IMapper mapper) { _settings = settings; // _context = new MongoContext(settings); _context = context; _logger = logger; _mapper = mapper; }
public RewardContext(IMongoSettings settings) : base(settings) { RegisterRewardInfos = base._database.GetCollection <RegisterRewardInfo>(nameof(RegisterRewardInfo)); GameActivityConfigs = base._database.GetCollection <GameActivityConfig>(nameof(GameActivityConfig)); RegisterRewardConfigs = base._database.GetCollection <RegisterRewardConfig>(nameof(RegisterRewardConfig)); LoginRewardConfigs = base._database.GetCollection <LoginRewardConfig>(nameof(LoginRewardConfig)); BankruptcyConfigs = base._database.GetCollection <BankruptcyConfig>(nameof(BankruptcyConfig)); InviteRewardConfigs = base._database.GetCollection <InviteRewardConfig>(nameof(InviteRewardConfig)); }
protected MongoDbRepositoryBase(IMongoSettings settings) { this._settings = settings; var client = new MongoClient(_settings.ConnectionString); var db = client.GetDatabase(_settings.DatabaseName); this.Collection = db.GetCollection <T>(typeof(T).Name.ToLowerInvariant()); NairobiSeed.SeedCategories(db.GetCollection <Category>(nameof(Category).ToLowerInvariant())); }
public UserService(IMongoSettings settings) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); _users = database.GetCollection <User>("users"); _gameSettings = database.GetCollection <GameSettings>("game_settings"); _gridFS = new GridFSBucket(database); }
public AuthenticationService(IMongoSettings mongoSettings, IMydemenageurSettings mydemenageurSettings) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _users = database.GetCollection <User>(mongoSettings.UsersCollectionName); _mydemenageurSettings = mydemenageurSettings; }
public MongoContext(IMongoSettings settings) { var client = new MongoClient(settings.ConnectionString); if (client != null) { _database = client.GetDatabase(settings.DatabaseName); } }
public TestController(IMongoSettings settings) { _settings = settings; var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); _books = database.GetCollection <Book>("Books"); _infos = database.GetCollection <TestInfo>("AccountInfo"); }
public MigrantService(IMongoSettings settings) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); _migrants = database.GetCollection <Migrant>(settings.CollectionName); _coordinatesData = GetLatitudeLongitudeInfo(); _statesDistricts = GetStatesWithDistricts(); _pincodeRegions = GetStatesDistrictWithPincode(); }
public UsersService(IMongoSettings mongoSettings, IFilesService filesService, IAuthenticationService authenticationService) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _users = database.GetCollection <User>("users"); _filesService = filesService; _authenticationService = authenticationService; }
protected BaseRepositoryMongo(IMongoClient mongoClient, IMongoSettings settings, ILogger logger) { Ensure.NotNull(mongoClient, nameof(mongoClient)); Ensure.NotNull(settings?.MongoDbName, nameof(settings.MongoDbName)); Ensure.NotNull(settings?.MongoCollectionName, nameof(settings.MongoCollectionName)); Ensure.NotNull(logger, nameof(logger)); MongoClient = mongoClient; Logger = logger; MongoSettings = settings; }
public ChallengeService(IMongoSettings settings) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); _teams = database.GetCollection <Team>("teams"); _users = database.GetCollection <User>("users"); _challenges = database.GetCollection <Challenge>("challenges"); _gridFS = new GridFSBucket(database); }
public AuthenticationService(IMongoSettings mongoSettings, IBuildupSettings buildupSettings, INotificationService notificationService) { var mongoClient = new MongoClient(mongoSettings.ConnectionString); var database = mongoClient.GetDatabase(mongoSettings.DatabaseName); _users = database.GetCollection <User>("users"); _buildupSettings = buildupSettings; _notificationService = notificationService; }
/// <summary> /// Initializes a new instance of the <see cref="MongoHelper"/> class. /// </summary> /// <param name="mongoSettings">The mongo settings.</param> internal MongoHelper(IMongoSettings mongoSettings) { _mongoSettings = mongoSettings; _mongo = MongoServer.Create(mongoSettings.GetSettigns()); _database = _mongo.GetDatabase(mongoSettings.Database); }