当前位置: 首页>>代码示例>>C#>>正文


C# MongoServer.Connect方法代码示例

本文整理汇总了C#中MongoServer.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# MongoServer.Connect方法的具体用法?C# MongoServer.Connect怎么用?C# MongoServer.Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoServer的用法示例。


在下文中一共展示了MongoServer.Connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

 public void Setup()
 {
     _server = MongoServer.Create("mongodb://localhost/?safe=true");
     _server.Connect();
     _database = _server["onlinetests"];
     _collection = _database["linqtests"];
 }
开发者ID:moonreplace,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoQueryableTests.cs

示例2: Setup

 public void Setup()
 {
     server = MongoServer.Create();
     server.Connect();
     database = server["onlinetests"];
     collection = database["testcollection"];
 }
开发者ID:kenegozi,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoCollectionTests.cs

示例3: Setup

 public void Setup()
 {
     server = MongoServer.Create("mongodb://localhost/?safe=true");
     server.Connect();
     database = server["onlinetests"];
     collection = database["testcollection"];
 }
开发者ID:modesto,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoCollectionTests.cs

示例4: Setup

 public void Setup()
 {
     server = MongoServer.Create("mongodb://localhost/?safe=true");
     server.Connect();
     server.DropDatabase("onlinetests");
     database = server["onlinetests"];
 }
开发者ID:jenrom,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoServerTests.cs

示例5: ConnectAsyncTask

 public async void ConnectAsyncTask()
 {
     _mongoServer = null;
     MongoClient client = new MongoClient(ConnectionString);
     _mongoServer = await Task.Run(() => client.GetServer());
     await Task.Run(() => _mongoServer.Connect());
 }
开发者ID:TheFastCat,项目名称:EasyMongo,代码行数:7,代码来源:ServerConnection.cs

示例6: Setup

 public void Setup()
 {
     _server = Configuration.TestServer;
     _server.Connect();
     _database = Configuration.TestDatabase;
     _database.Drop();
 }
开发者ID:robinNode,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoDatabaseTests.cs

示例7: Connect

 /// <summary>
 /// Synchronous connection. This method or <see cref="ConnectAsyncDelegate"/> must be called prior to utilizing the ServerConnection.
 /// </summary>
 public void Connect()
 {          
     _mongoServer = null;
     MongoClient client = new MongoClient(ConnectionString);
     _mongoServer = client.GetServer();
     _mongoServer.Connect();
 }
开发者ID:TheFastCat,项目名称:EasyMongo,代码行数:10,代码来源:ServerConnection.cs

示例8: Setup

 public void Setup()
 {
     server = MongoServer.Create();
     server.Connect();
     server.DropDatabase("onlinetests");
     database = server["onlinetests"];
 }
开发者ID:kenegozi,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoDatabaseTests.cs

示例9: MongoRepository

 public MongoRepository(MongoUrl mongoUrl, string databaseName)
 {
     _client = new MongoClient(mongoUrl);
     _server = _client.GetServer();
     _database = databaseName;
     _server.Connect();
 }
开发者ID:WuLex,项目名称:PerformanceCounterCollect,代码行数:7,代码来源:MongoRepository.cs

示例10: Setup

 public void Setup()
 {
     _server = Configuration.TestServer;
     _server.Connect();
     _database = Configuration.TestDatabase;
     _collection = Configuration.TestCollection;
 }
开发者ID:wireclub,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoCollectionTests.cs

示例11: btnConnect_Click

 private void btnConnect_Click(object sender, EventArgs e)
 {
     Card.CardUtility.Init();
     innerServer = MongoServer.Create(@"mongodb://localhost:28030");
     innerServer.Connect();
     innerDatabase = innerServer.GetDatabase("HearthStone");
     innerCollection = innerDatabase.GetCollection("Card");
 }
开发者ID:jonesgithub,项目名称:MagicMongoDBTool,代码行数:8,代码来源:CardUnit.cs

示例12: MongoRepository

 public MongoRepository(
     string connectionString,
     string database)
 {
     _Server = MongoServer.Create(connectionString);
     _Database = connectionString.ParseDatabaseName() ?? database;
     _Server.Connect();
 }
开发者ID:kayone,项目名称:NLog.MongoDB,代码行数:8,代码来源:MongoRepository.cs

示例13: Init

 private void Init(string conStr)
 {
     MongoUrl url = new MongoUrl(conStr);
     string dbName = string.IsNullOrEmpty(url.DatabaseName) ? "TEST" : url.DatabaseName;
     Server = MongoServer.Create(conStr);
     Server.Connect();
     Database = Server.GetDatabase(dbName);
 }
开发者ID:pashkov,项目名称:Spontaneous,代码行数:8,代码来源:MongoRepositoryBase.cs

示例14: btnImport_Click

 /// <summary>
 /// 导入按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnImport_Click(object sender, EventArgs e)
 {
     innerServer = MongoServer.Create(@"mongodb://localhost:28030");
     innerServer.Connect();
     innerDatabase = innerServer.GetDatabase("HearthStone");
     innerCollection = innerDatabase.GetCollection("Card");
     if (String.IsNullOrEmpty(ExcelPicker.SelectedPathOrFileName)) return;
     Import();
     GC.Collect();
     innerServer.Disconnect();
 }
开发者ID:jonesgithub,项目名称:MagicMongoDBTool,代码行数:16,代码来源:frmImport.cs

示例15: OnTestFixtureSetUp

        protected virtual void OnTestFixtureSetUp() {

            if(IoC.IsNotInitialized)
                IoC.Initialize();

            if(IsDebugEnabled)
                log.Debug("MongoDB 서버에 접속합니다. connectionString=[{0}]", DefaultConnectionString);

            Server = MongoServer.Create(DefaultConnectionString);
            Server.Connect();
            Server.DropDatabase(DefaultDatabaseName);
            Database = Server[DefaultDatabaseName];
        }
开发者ID:debop,项目名称:NFramework,代码行数:13,代码来源:MongoFixtureBase.cs


注:本文中的MongoServer.Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。