public virtual IMongoCollection <T> GetDataCollection <T>(string collectionName) { // 优先选择 实体标签所制定的数据库名 var databaseName = typeof(T).GetAttributeValue <DatabaseAttribute, string>(t => t.Name); if (databaseName == null) { databaseName = this.defaultDatabaseName; if (databaseName == null) { throw new Exception( "You must specified the [Database] attribute for the domain model or set the default database name at the configuration file."); } } return(MongoDBCollection.GetCollection <T>(this.currentClient, databaseName, collectionName)); }
public virtual IMongoCollection <T> GetDataCollection <T>(MongoClient client, string databaseName, string collectionName) { return(MongoDBCollection.GetCollection <T>(client, databaseName, collectionName)); }