开发者

Entity framework running sprocs and native queries performance considerations

I'm wondering if there's a performance penalty when doing the following vs using plain old ado.net DataReader and DataTable:

using(DBEntities dbEntities = new dbEntities)
{
    ObjectResult<tblCustomers> customers =
        dbEntities.ExecuteStoreQuery<tblCustomers>("SELECT name,id FROM tblCustomers");
}

I would also like to run sprocs using dbEntity.

I mention this because i'm developing a highly performance sensitive application but would still like to use the entity framework.

furtherm开发者_如何转开发ore, can anyone point me to recent performance tests of linq to entities compiled queries on .net 4.0?

EDIT

If i go with ado.net i plan on inserting the results i get from each row to a .net object manually. So it's entity framework storequery/sproc vs ado.net + manually creating and inserting data to a .net object.


Yes, of course - this is a higher-level approach than plain ADO.NET / SQL.

You send in a SQL query and get back a list of tblCustomers objects. Somewhere along the line, a mapping from the database's row/column to the object will happen, and this does take some time.

On the other hand - if you want to do the same thing yourself, you will have to pay a performance penalty, too - or you just use the old-style row/column to do your work (not recommended!).

It's the classic "convenience vs. performance" trade-off - what is more important to you? Being able to program with nice C# objects and their properties and be very productive as a programmer - or a few nanoseconds on the SELECT from your database? It's your pick....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜