Example #1
0
 /// <summary>
 /// 若设置过MongoServerAddress 、MongReplicaSetName则已cluster优先
 /// 否则默认为最后一个ConnectionString设置
 /// </summary>
 /// <param name="inputStr"></param>
 public MongoRepository(string inputStr)
 {
     if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["MongReplicaSetName"]) &&
         !string.IsNullOrEmpty(ConfigurationManager.AppSettings["MongoServerAddress"]))
     {
         this.collection = Extentions <TKey> .GetCollectionFromCluster <T>(inputStr);
     }
     else
     {
         this.collection = Extentions <TKey> .GetCollectionFromConnectionString <T>(inputStr);
     }
 }
Example #2
0
        /// <summary>
        /// 若设置过MongoServerAddress 、MongReplicaSetName则已cluster优先
        /// 否则默认为最后一个ConnectionString设置
        /// </summary>
        /// <param name="connectionString"></param>
        public MongoDBOperatorBase(string connectionString)
        {
            _connStr = connectionString;

            if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["MongReplicaSetName"]) &&
                !string.IsNullOrEmpty(ConfigurationManager.AppSettings["MongoServerAddress"]))
            {
                this.collection = Extentions <TKey> .GetCollectionFromCluster <T>(connectionString);
            }
            else
            {
                this.collection = Extentions <TKey> .GetCollectionFromConnectionString <T>(connectionString);
            }
        }
Example #3
0
 public MongoRepository(string connectionString, string collectionName)
 {
     this.collection = Extentions <TKey> .GetCollectionFromConnectionString <T>(connectionString, collectionName);
 }
 public MongoOperatorManager(string connectionString, string collectionName)
 {
     this.collection = Extentions <TKey> .GetCollectionFromConnectionString <T>(connectionString, collectionName);
 }
Example #5
0
 public MongoDBOperatorBase(string connectionString, string collectionName)
 {
     _connStr        = connectionString;
     this.collection = Extentions <TKey> .GetCollectionFromConnectionString <T>(connectionString, collectionName);
 }