示例#1
0
        public static DatabaseFactory Init(MongoDbCredentials mongoCredentials)
        {
            if (_instance == null)
            {
                lock (_instanceLock)
                {
                    if (_instance == null)
                    {
                        _instance = new DatabaseFactory(mongoCredentials);
                    }
                }
            }

            return(_instance);
        }
示例#2
0
 private DatabaseFactory(MongoDbCredentials mongoCredentials)
 {
     this.mongoClient   = new MongoClient(mongoCredentials.ConnectionString);
     this.MongoDatabase = mongoClient.GetDatabase(mongoCredentials.Database);
 }