public void CreateCreateChunksCollectionIndexesOperation_should_return_expected_result( [Values(1, 2)] int databaseW, [Values(null, 1, 2)] int? bucketW) { var bucketWriteConcern = bucketW.HasValue ? new WriteConcern(bucketW.Value) : null; var options = new GridFSBucketOptions { WriteConcern = bucketWriteConcern }; var subject = CreateSubject(options); var databaseWriteConcern = new WriteConcern(databaseW); var mockDatabase = Mock.Get(subject.Database); var databaseSettings = new MongoDatabaseSettings { WriteConcern = databaseWriteConcern }; mockDatabase.SetupGet(d => d.Settings).Returns(databaseSettings); var result = subject.CreateCreateChunksCollectionIndexesOperation(); result.CollectionNamespace.CollectionName.Should().Be("fs.chunks"); result.MessageEncoderSettings.Should().NotBeNull(); result.Requests.Should().NotBeNull(); result.WriteConcern.Should().BeSameAs(bucketWriteConcern ?? databaseWriteConcern); }
public IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null) { return(new MockMongoDatabase()); }
/// <summary> /// Get the email client using connection information from the test run configuration /// </summary> /// <returns>The email connection</returns> public static IMongoCollection <T> GetCollection <T>(string connectionString, string databaseString, MongoDatabaseSettings settings, string collectionString) { var connection = new MongoClient(new MongoUrl(connectionString)); var database = connection.GetDatabase(databaseString, settings); return(database.GetCollection <T>(collectionString)); }
public IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null) => databases.GetOrAdd(name, n => new InMemoryDatabase(this, n, iocContainer));
public abstract IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null);
//public Connect(DBConfigration configuration) //{ // string mongoConnectionString = configuration.ConnectionString; // string mongoDatabase = configuration.Database; // this.Client = new MongoClient(mongoConnectionString); // this.DataBase = this.Client.GetDatabase(mongoDatabase, null); // this.DatabaseSettings = this.DataBase.Settings; //} //public Connect(DBConfigration configuration, MongoDatabaseSettings databaseSettings) //{ // string mongoConnectionString = configuration.ConnectionString; // string mongoDatabase = configuration.Database; // this.Client = new MongoClient(mongoConnectionString); // this.DataBase = this.Client.GetDatabase(mongoDatabase, databaseSettings); // this.DatabaseSettings = this.DataBase.Settings; //} public Connect(MongoUrl mongoUrl) { this.Client = new MongoClient(mongoUrl); this.DataBase = this.Client.GetDatabase(mongoUrl.DatabaseName); this.DatabaseSettings = this.DataBase.Settings; }
private void JustDecompileGenerated_set_DatabaseSettings(MongoDatabaseSettings value) { this.JustDecompileGenerated_DatabaseSettings_k__BackingField = value; }
public virtual IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null) => throw new NotImplementedException();
public MongoDbContextOptions(string connectionString, string databaseName = null, MongoDatabaseSettings settings = null) : base(connectionString, databaseName, settings) { }
public IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null) { return(_client.GetDatabase(name, settings).AsTransactionDatabase()); }
/// <summary> /// 获取数据库 /// </summary> /// <param name="name"></param> /// <param name="settings"></param> /// <returns></returns> public virtual IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null) { return(Context.GetDatabase(name, settings)); }
public IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null) => _mongoClient.GetDatabase(name, settings);
public Connect(IMongoDatabase mongoDatabase) { this.Client = mongoDatabase.Client; this.DataBase = mongoDatabase; this.DatabaseSettings = mongoDatabase.Settings; }
public Connect(IMongoClient mongoClient, string databaseName, MongoDatabaseSettings databaseSettings = null) { this.Client = mongoClient; this.DataBase = this.Client.GetDatabase(databaseName, databaseSettings); this.DatabaseSettings = databaseSettings; }
public MongoDbStoreStrategy(string databasename, MongoDatabaseSettings settings) { MongoDB.Driver.MongoClient client = new MongoDB.Driver.MongoClient(); database = client.GetDatabase(databasename, settings); }
public static Builder Create(string connectionString, string database, MongoDatabaseSettings settings = null) => new Builder(connectionString, database, settings);
public override IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null) { return(_databases.GetOrAdd(name, CreateDatabase)); }
public IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null) { return(wrapped.GetDatabase(name, settings)); }
public MongoRepository Connect(string databaseName, MongoDatabaseSettings mongoDatabaseSettings = null) { _MongoDatabase = _MongoClient.GetDatabase(databaseName, mongoDatabaseSettings); return(this); }
public MongoDbContext(string connection, MongoDatabaseSettings settings) : this(connection) { var mongoUrl = new MongoUrl(connection); Database = Client.GetDatabase(mongoUrl.DatabaseName, settings); }
public Connect(MongoDatabaseSettings databaseSettings) { this.Client = new MongoClient(ConfigurationManager.AppSettings["MongoConnectionString"]); this.DataBase = this.Client.GetDatabase(ConfigurationManager.AppSettings["MongoDatabase"], databaseSettings); this.DatabaseSettings = this.DataBase.Settings; }
public void CreateDropCollectionOperation_should_return_expected_result( [Values(1, 2)] int databaseW, [Values(null, 1, 2)] int? bucketW) { var bucketWriteConcern = bucketW.HasValue ? new WriteConcern(bucketW.Value) : null; var options = new GridFSBucketOptions { WriteConcern = bucketWriteConcern }; var subject = CreateSubject(options); var databaseWriteConcern = new WriteConcern(databaseW); var mockDatabase = Mock.Get(subject.Database); var databaseSettings = new MongoDatabaseSettings { WriteConcern = databaseWriteConcern }; mockDatabase.SetupGet(d => d.Settings).Returns(databaseSettings); var collectionNamespace = new CollectionNamespace(subject.Database.DatabaseNamespace, "collection"); var messageEncoderSettings = new MessageEncoderSettings(); var result = subject.CreateDropCollectionOperation(collectionNamespace, messageEncoderSettings); result.CollectionNamespace.Should().BeSameAs(collectionNamespace); result.MessageEncoderSettings.Should().BeSameAs(messageEncoderSettings); result.WriteConcern.Should().BeSameAs(bucketWriteConcern ?? databaseWriteConcern); }
public Connect(string connectionString, string databaseName, MongoDatabaseSettings databaseSettings) { this.Client = new MongoClient(connectionString); this.DataBase = this.Client.GetDatabase(databaseName, databaseSettings); this.DatabaseSettings = databaseSettings; }
public IMongoDatabase GetDatabase(MongoDatabaseSettings settings = null) { return(server.GetDatabase(dbName, settings)); }