Dapper Vs Dbentry

Source: Internet
Author: User

The dapper used by the company's project database access has not been used before. Today a simple test was made, dapper and dbentry query efficiency situation.

  Public ActionResult Test ()        {            sys_userfacade su = new Sys_userfacade ();                 var result = string. Empty;           System.Diagnostics.Stopwatch SW = new System.Diagnostics.Stopwatch ();           Sw. Start ();           var list = su. Getsys_userlist ();           Sw. Stop ();           Result + = "Dapper: Query" + list. Count () + "bar data time consuming" + SW. Elapsedmilliseconds + "MS";           Sw. Reset ();           Sw. Start ();           var list2 = Sysuser.find (u=>u.logincount==2);                     Sw. Stop ();           Result + = "Vs dbentry:" + list2. Count () + "bar data time consuming" + SW. Elapsedmilliseconds + "Ms 

  

SQL 2012, native, 140w+ data, made a simple full table query, and conditional query. Execution efficiency is as follows:

Dapper: 1,408,128 data query time 7474 milliseconds Vs dbentry:1408064 data 6370 ms
Dapper: 1,408,128 data query time 7372 milliseconds Vs dbentry:1408064 data 6453 ms
Dapper: 1,408,128 data query time 7423 milliseconds Vs dbentry:1408064 data 6466 ms
Dapper: 1,408,128 data query time 7288 milliseconds Vs dbentry:1408064 data 6646 ms
Dapper: 1,408,128 data query time 7172 milliseconds Vs dbentry:1408064 data 6667 ms
Dapper: 128 Data query time 50 milliseconds Vs dbentry:128 data 30 ms
Dapper: 128 Data query time 47 milliseconds Vs dbentry:128 Data 29 ms
Dapper: 128 Data query time 42 milliseconds Vs dbentry:128 Data 30 ms
Dapper: 128 data query time 41 milliseconds Vs dbentry:128 Data 38 ms
Dapper: 128 Data query time 44 milliseconds Vs dbentry:128 data 29 ms

Summary: Two efficiency is similar, dbentry slightly wins a point.

There is a small problem with dapper today, the database connection string is configured in Web. config as follows

<connectionStrings>
<add name= "smdbconnectionstring" connectionstring= "Data source= (local); Initial catalog=***; User id=xxx; Password=xxxx "providername=" System.Data.SqlClient "/>
</connectionStrings>

Used in the program

Cnnstringname = Configurationmanager.connectionstrings[0]. Name;

Access the connection string name and find that the connection name returned is not desired. Instead, it inherits the connections in the Machine.config.

Workaround:

1: Add a <clear/> in the Web. config connectionstrings node first

2: or direct configurationmanager.connectionstrings[1]

Dapper Vs Dbentry

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.