示例#1
0
 private void btnUpload_Click(object sender, EventArgs e)
 {
     if (this.txtFileName.Text.Trim() != "")
     {
         if (File.Exists(this.txtFileName.Text))
         {
             var config = new MongoConfig
             {
                 AuthDb                = "admin",
                 ConnectTimeout        = 300000,
                 DefaultDb             = "yudiefly",
                 PassWord              = "******",
                 UserName              = "******",
                 ServerPort            = 27017,
                 ServerConStr          = "139.224.196.218",
                 SocketTimeout         = 180000,
                 MaxConnectionIdleTime = 60000,
                 MaxConnectionLifeTime = 600000,
                 MaxConnectionPoolSize = 600,
                 WaitQueueSize         = 10,
                 WaitQueueTimeout      = 120000
             };
             var repostory = new DoMongoRepostory <myValueObject>("yudiefly", "test_file_upload", config);
             var result    = repostory.UploadFile(this.txtFileName.Text, "test_file_upload");
         }
     }
 }
 /// <summary>
 /// 初始化
 /// </summary>
 public HelloWorldService(MongoConfig mongoConfig)
 {
     RepostoryL = new DoMongoRepostory <HelloWorldEntity>(MONGODB_CONFIG_SELECTION_KEY, PENDING_DATA_L_COLLECTION_NAME, mongoConfig);
 }