最快到:在.NET数据库中检索数据的方式? [英] Fastest way to retrieve data from a database in .NET?

查看:180
本文介绍了最快到:在.NET数据库中检索数据的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 ADO.NET ,什么是从数据库中检索数据的最快方法和填充数据到我的业务对象?

Using ADO.NET, what is the fastest way to retrieve data from the database and populate the data into my business objects?

哪一个我应该使用? DBDataReader DbDataAdapter的,或任何其他类?

Which one should I use? DBDataReader , DBDataAdapter, or any other classes?

有没有一种方法,使这个过程自动化?让基于属性名称,并与数据库中的字段名匹配他们说?

Is there a way to make this process automated? Let's say based on property names and matching them with database field names?

推荐答案

这听起来跟哪一个ORM或微型ORM一样。这里是短小精悍点网的的performance测试(运行约1分钟前,一台PC,这也是忙做一些转换,所以不是100%可靠的 - 请运行你自己)...这也是一个非常有限的测试 - 一如既往,测试应重新您的特定环境的presentative - 但因为我们不能 predict 的环境中,我们用我们的环境,而不是!我标志着短小精悍的人作为< ====短小精悍

That sounds exactly like what an ORM or micro-ORM does. Here's the output of dapper-dot-net's performance tests (run about 1 minute ago, on a PC that is also busy doing some transcoding, so not 100% reliable - please run yourself)... This is also a very limited test - as always, tests should be representative of your specific environment - but since we can't predict your environment, we use our environment instead! I've marked the "dapper" ones as <==== dapper

Running 500 iterations that load up a post entity
Mapper Query (non-buffered) took 57ms          <==== dapper
hand coded took 57ms
Dynamic Mapper Query (buffered) took 58ms      <==== dapper
PetaPoco (Fast) took 58ms
Dynamic Mapper Query (non-buffered) took 59ms  <==== dapper
Mapper Query (buffered) took 60ms              <==== dapper
Dapper.Cotrib took 60ms                        <==== dapper
PetaPoco (Normal) took 66ms
Dynamic Massive ORM Query took 67ms
BLToolkit took 88ms
Simple.Data took 96ms
Linq 2 SQL Compiled took 99ms
NHibernate Session.Get took 127ms
SubSonic Coding Horror took 128ms
Entity framework CompiledQuery took 130ms
NHibernate HQL took 132ms
NHibernate SQL took 134ms
NHibernate Criteria took 173ms
Soma took 184ms
Linq 2 SQL ExecuteQuery took 230ms
Linq 2 SQL took 694ms
NHibernate LINQ took 700ms
Entity framework ESQL took 730ms
Entity framework ExecuteStoreQuery took 735ms
Entity framework took 991ms
Entity framework No Tracking took 1011ms
SubSonic ActiveRecord.SingleOrDefault took 4345ms
(end of tests; press any key)

这篇关于最快到:在.NET数据库中检索数据的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆