public BaseRepository(IMongoConfiguration settings) { var client = new MongoClient(settings.ConnectionString); var database = client.GetDatabase(settings.DatabaseName); _mongoCollection = database.GetCollection <TModel>(typeof(TModel).Name.ToLowerInvariant()); }
/// <summary> /// Initializes a new instance of the <see cref="MongoWorkflowDataAccess"/> class. /// </summary> /// <param name="configuration">The configuration options.</param> public MongoWorkflowDataAccess(IMongoConfiguration configuration) { this.Configuration = configuration; MongoClient client = new MongoClient(configuration.ToMongoClientSettings()); this.Server = client.GetServer(); this.Database = this.Server.GetDatabase(configuration.Database); }
public MongoEventStore(IMongoConfiguration mongoConfiguration, IEventBus eventBus) : base(eventBus) { _server = MongoServer.Create(mongoConfiguration.Url); var mongoDatabaseSettings = _server.CreateDatabaseSettings(mongoConfiguration.DatabaseName); _database = _server.GetDatabase(mongoDatabaseSettings); }
/// <summary> /// Initializes a new instance of the <see cref="MongoSystemEventLogger"/> class. /// </summary> /// <param name="configuration">The configuration options.</param> public MongoSystemEventLogger(IMongoConfiguration configuration) { this.Configuration = configuration; MongoClient client = new MongoClient(configuration.ToMongoClientSettings()); this.Server = client.GetServer(); this.Database = this.Server.GetDatabase(configuration.Database); }
public MessageMongoRepository(ITenantService tenantService, IMongoConfiguration mongoConfiguration) : base(tenantService, mongoConfiguration, "messages") { CreateIndexIfNotExists("message-index", Builders <IMessageDetail> .IndexKeys .Ascending(i => i.MessageId) .Ascending(i => i.SentBy)); }
public LoginService(IDistributedCache cache , IMongoConfiguration mongoConfig , IHubContext <LoginHub> loginHub , IPlayerService playerService) : base(cache, mongoConfig) { _loginHub = loginHub; _playerService = playerService; }
public void SetUp() { configuration = Substitute.For <IMongoConfiguration>(); configuration.ConnectionString.Returns(MongoDbConnectionStringValue); mongoClientFactory = new MongoClientFactory(); }
public ReportRepository(IMongoConfiguration configuration) { _configuration = configuration; var client = new MongoClient(_configuration.ConnectionString); _database = client.GetDatabase(_configuration.Database); }
public MongoClient GetOrCreate(IMongoConfiguration mongoConfiguration) { if (this.mongoClient == null) { this.mongoClient = new MongoClient(mongoConfiguration.ConnectionString); } return(this.mongoClient); }
protected MongoRepositoryBase( IMongoClientProvider mongoClientProvider, IMongoConfiguration mongoConfiguration) { this.MongoConfiguration = mongoConfiguration; this.MongoClient = mongoClientProvider.GetOrCreate(this.MongoConfiguration); this.MongoDatabase = this.MongoClient.GetDatabase(this.MongoConfiguration.DatabaseName); this.MongoCollection = this.GetOrCreateCollection(); }
public MongoProvider(IMongoConfiguration configuration) { Configuration = configuration; var connectionString = Configuration.ConnectionString; var dbName = configuration.DatabaseName; Client = new MongoClient(connectionString); _database = Client.GetDatabase(dbName); }
/// <summary> /// Initializes a new instance of the <see cref="DatabaseInitialiser"/> class. /// </summary> /// <param name="mongoConfiguration">The MongoDB configuration settings.</param> /// <param name="installOptions">The database install options.</param> /// <param name="variables">A cache of install variables.</param> /// <param name="installLogger">Logs installation results.</param> public DatabaseInitialiser(IMongoConfiguration mongoConfiguration, DatabaseInitialiserOptions installOptions, InstallVariables variables, InstallLogger installLogger) { this.mongoConfiguration = mongoConfiguration; this.installConfiguration = installOptions; this.installVariables = variables; this.installLogger = installLogger; this.ReadInput = delegate { return string.Empty; }; this.ReadPassword = delegate { return string.Empty; }; }
public BaseService(IDistributedCache cache, IMongoConfiguration mongoConfig = null) { cacheDB = cache; if (mongoConfig != null) { _mongoConfig = mongoConfig; mongoClient = new MongoClient(mongoConfig.ConnectionString); mongoDB = mongoClient.GetDatabase(mongoConfig.DatabaseName); } }
/// <summary> /// Initializes a new instance of the <see cref="MongoDataAccess" /> class. /// </summary> /// <param name="configuration">The configuration options.</param> public MongoDataAccess(IMongoConfiguration configuration) { this.Configuration = configuration; MongoClient client = new MongoClient(configuration.ToMongoClientSettings()); this.Server = client.GetServer(); this.Database = this.Server.GetDatabase(configuration.Database); this.JsonSettings = new JsonWriterSettings { OutputMode = JsonOutputMode.Strict, Indent = false, NewLineChars = string.Empty }; }
public BoardService(IDistributedCache cache , IMongoConfiguration mongoConfiguration , IPlayerService playerService , IHubContext <BoardHub> boardHub) : base(cache, mongoConfiguration) { _playerService = playerService; _boardHub = boardHub; _mapBoard = new Dictionary <Guid, Board>(); _mapPlayerInBoard = new Dictionary <Guid, Board>(); _dicNewBoards = new Dictionary <Guid, Board>(); _dicBoards = new Dictionary <Guid, Board>(); }
public MongoFactory(IMongoConfiguration mongoConfiguration) { _databaseName = mongoConfiguration.DatabaseName; var username = mongoConfiguration.Username; var password = mongoConfiguration.Password; var host = mongoConfiguration.Host; var port = mongoConfiguration.Port; var credentials = MongoCredential.CreateCredential(_databaseName, username, password); var settings = MongoHelpers.GetMongoClientSettings(host, port, credentials); _mongoClient = new MongoClient(settings); }
/// <summary> /// Creates the client. /// </summary> /// <param name="configuration">The configuration.</param> /// <returns></returns> /// <exception cref="NStruct.FatalException"> /// Mongo host has not configured! /// or /// Database has not created! /// </exception> private IMongoClient CreateClient(IMongoConfiguration configuration) { if (string.IsNullOrEmpty(configuration.Host)) { throw new FatalException("Mongo host has not configured!"); } if (string.IsNullOrEmpty(configuration.Database)) { throw new FatalException("Database has not created!"); } var client = new MongoClient(MongoUrl.Create(configuration.Host)); _mongoDatabase = client.GetDatabase(configuration.Database); return(client); }
public void SetUp() { // Arrange configurationFactory = Substitute.For <IMongoConfigurationFactory>(); configuration = Substitute.For <IMongoConfiguration>(); client = Substitute.For <IMongoClient>(); configurationFactory.Create().Returns(configuration); configuration.ConnectionString.Returns(MongoDbConnectionStringValue); configuration.DatabaseName.Returns(MongoDbDatabaseNameValue); var database = Substitute.For <IMongoDatabase>(); client.GetDatabase(configuration.DatabaseName).Returns(database); databaseFactory = new MongoDatabaseFactory(); }
public MongoContext(IMongoConfigurationFactory configurationFactory, IMongoClientFactory clientFactory, IMongoDatabaseFactory databaseFactory, IMongoCollectionFactory <Question> questionCollectionFactory, IMongoCollectionFactory <Answer> answerCollectionFactory, IMongoCollectionFactory <SearchTerm> searchTermCollectionFactory) { this.configurationFactory = configurationFactory; this.clientFactory = clientFactory; this.databaseFactory = databaseFactory; this.questionCollectionFactory = questionCollectionFactory; this.answerCollectionFactory = answerCollectionFactory; this.searchTermCollectionFactory = searchTermCollectionFactory; configuration = configurationFactory.Create(); var client = clientFactory.Create(configuration); database = databaseFactory.GetDatabase(configuration, client); EnforceTextIndexes(); }
public MongoConnection(IMongoConfiguration configuration) { _configuration = configuration; }
public GameConfigService(IDistributedCache cache, IMongoConfiguration mongoConfig) : base(cache, mongoConfig) { LoadRankDefinition(); }
public PositionReaderService(IMongoConfiguration mongoConfiguration) { _mongoConfiguration = mongoConfiguration; }
/// <summary> /// Gathering repository /// </summary> /// <param name="configuration"></param> public GatheringRepository(IMongoConfiguration configuration) { _mongoCollection = configuration.MongoDatabase.GetCollection <Gathering>(typeof(Gathering).Name); }
public IdempotenceWriterService(IMongoConfiguration mongoConfiguration) { _mongoConfiguration = mongoConfiguration; }
public IMongoDatabase GetDatabase(IMongoConfiguration configuration, IMongoClient client) { return(client.GetDatabase(configuration.DatabaseName)); }
/// <summary> /// Initializes a new instance of the <see cref="MongoDataAccess"/> class. /// </summary> /// <param name="configuration">The configuration options.</param> public MongoDataAccess(IMongoConfiguration configuration) { MongoClient client = new MongoClient(configuration.ToMongoClientSettings()); MongoServer server = client.GetServer(); this.database = server.GetDatabase(configuration.Database); }
public OrderRepository(IMongoConfiguration mongoConfiguration, IMongoClient client) { var database = client.GetDatabase(mongoConfiguration.Database); _collection = database.GetCollection <Order>(mongoConfiguration.OrderCollection); }
public MongoContext(IMongoConfiguration mongoConfig) { var client = new MongoClient(mongoConfig.connectionString); _database = client.GetDatabase(mongoConfig.databaseName); }
// : base(mongoConfiguration) public PostRepository(IMongoConfiguration mongoConfiguration) { }
public ReadDbContext(IMongoConfiguration mongoConfiguration) : base(mongoConfiguration) { }
public MongoDbContext(IMongoConfiguration configuration) { _mongoClient = new MongoClient(configuration.ConnectionString); _mongoDatabase = _mongoClient.GetDatabase(configuration.DbName); Schools = _mongoDatabase.GetCollection <School>(configuration.SchoolsCollectionName); }
public IMongoClient Create(IMongoConfiguration configuration) { return(new MongoClient(configuration.ConnectionString)); }
protected MongoRepositoryTemplate( IMongoClientProvider mongoClientProvider, IMongoConfiguration mongoConfiguration) : base(mongoClientProvider, mongoConfiguration) { }
public TenantMongoRepository( IMongoClientProvider mongoClientProvider, IMongoConfiguration mongoConfiguration) : base(mongoClientProvider, mongoConfiguration) { }
public ContentTypeMongoRepository( IMongoClientProvider mongoClientProvider, IMongoConfiguration mongoConfiguration) : base(mongoClientProvider, mongoConfiguration) { }
protected MongoDbContext(IMongoConfiguration mongoConfiguration) { _mongoClient = new MongoClient(mongoConfiguration.GetConnectionString()); _database = _mongoClient.GetDatabase(mongoConfiguration.GetDatabaseName()); }
public UserInfoDbContext(IMongoConfiguration configuration) { var client = new MongoClient(configuration.ConnectionString); _database = client.GetDatabase(MongoUrl.Create(configuration.ConnectionString).DatabaseName); }
// : base(mongoConfiguration) public UserRepository(IMongoConfiguration mongoConfiguration) { }