Пример #1
0
        /// <summary>
        /// 初始化实例
        /// </summary>
        /// <param name="connectionStringName"></param>
        public MongoService(string connectionStringName)
        {
            MongoConnectionString connectionString = new MongoConnectionString(ConfigurationManager.AppSettings[connectionStringName]);

            client   = new MongoClient(connectionString.Host);
            database = client.GetDatabase(connectionString.DatabaseName);
        }
Пример #2
0
 /// <summary>
 /// 初始化实例
 /// </summary>
 /// <param name="connectionStringName"></param>
 public MongoService(MongoConnectionString connectionString)
 {
     client   = new MongoClient(connectionString.Host);
     database = client.GetDatabase(connectionString.DatabaseName);
 }