开发者

LINQ to SQL vs. Enterprise Library

I have 1 million records inserted per day. My front end is C# 4.0 and my back end is MS SQL Server 2008 R2.

What method should I use to开发者_Python百科 gain the best performance? Should I use LINQ To SQL or Enterprise Library 5.0 or something else?


If you're going to be inserting that many rows into a database, you should consider using SQL Server Bulk Insert. It was designed to handle these kinds of loads. I love Linq to SQL, but it won't handle this sort of load too well.


Is that 1 million in one batch, or a million times 1 record at a time?

If you are looking for batch, you can forget about Linq2sql with these kind of volumes. Have a look at the SqlBulkCopy class, that is magnitues faster.

So you can opt for a hybrid solution - use SqlBulkCopy for your batch and you can still use linq2sql for queries and CRUD actions on single entities (or small batches).

It it is only one record at a time distributed evenly, i think you will still manage with Linq2sql.


I agree with the others on how to do batch operations, however I would not suggest LINQ to SQL at all. Use Entity Framework instead. It is much more flexible.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜