Ejemplo n.º 1
0
        public LoggingDBServices(IMongoSettings settings)
        {
            var client   = new MongoClient(settings.ConnectionString);
            var database = client.GetDatabase(settings.DatabaseName);

            _logs = database.GetCollection <RequestLogs>("Request_Logs");
        }
Ejemplo n.º 2
0
        public MongoRepository(IMongoSettings settings)
        {
            var client   = new MongoClient(settings.ConnectionString);
            var database = client.GetDatabase(settings.DatabaseName);

            Categories = database.GetCollection <Category>(settings.CollectionName);
        }
Ejemplo n.º 3
0
        //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);
        }
Ejemplo n.º 4
0
        public FilesService(IMongoSettings mongoSettings)
        {
            var mongoClient = new MongoClient(mongoSettings.ConnectionString);
            var database    = mongoClient.GetDatabase(mongoSettings.DatabaseName);

            _gridFS = new GridFSBucket(database);
        }
Ejemplo n.º 5
0
        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");
        }
Ejemplo n.º 7
0
        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);
 }
Ejemplo n.º 9
0
 public MongoService(IMongoSettings settings)
 {
     if (settings?.ConnectionString != null)
     {
         client   = new MongoClient(settings.ConnectionString);
         database = client.GetDatabase(settings.DatabaseName);
     }
 }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        public PersonRepository(IMongoSettings mongoSettings)
        {
            var mongoClient = new MongoClient(mongoSettings.ConnectionString);

            var collection = mongoClient.GetDatabase("PersonAPI").GetCollection <Person>("Person");

            this.PersonCollection = collection;
        }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
 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);
 }
Ejemplo n.º 17
0
        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");
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
 public ProductTypeRepository(IMongoSettings settings, ILoggerManager logger, MongoContext context, IMapper mapper)
 {
     _settings = settings;
     // _context = new MongoContext(settings);
     _context = context;
     _logger  = logger;
     _mapper  = mapper;
 }
Ejemplo n.º 20
0
 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()));
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
        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);
            }
        }
Ejemplo n.º 25
0
        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();
        }
Ejemplo n.º 27
0
        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;
        }
Ejemplo n.º 29
0
        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);
        }
Ejemplo n.º 30
0
        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;
        }
Ejemplo n.º 31
0
 /// <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);
 }