MongoDB samus Driver (1), mongodbsamus driver

Source: Internet
Author: User

MongoDB samus Driver (1), mongodbsamus driver

Https://github.com/samus/mongodb-csharp

The official driver is not easy, so I used this,

1 var connectionString = new mongoonstringbuilder () 2 {3 ConnectionTimeout = TimeSpan. fromSeconds (30), 4 ConnectionLifetime = TimeSpan. fromSeconds (10), 5 MinimumPoolSize = 1, 6 MaximumPoolSize = 10, 7 Pooled = true, // use the connection pool 8 };

When a connection pool is used, a connection will be established every time a database command is specified. The connection pool will be slow, set to the maximum, and the connection pool will be slow,

_ Mongo. Disconnect () // release resources, no matter whether it is used. I don't know whether it is the drive BUG or other problems.

The solution in the project is to use a singleton connection:

Static IMongo _ mongo = null; // single-instance connection

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.