[.NET development] How to automatically close your contexts

Introductio

If you've reamy articleaboutIQueryable maybe you now want to try it.As you know this class allow you to build your request progressively and execute it only at the last last moment by your Database Server, which permit to execute really optimized requests. It means you have to keep your contexts alive until this moment otherwise the request can't be executed (DataContext if you use Linq to SQL or DbContext with Entity Framework).Lot of people say that the C# Garbage Collector is very good and dispose everything without carrying anything. This is true that the garbage collector is very good, however it is not perfect. So your connections with SQL Server won't be closed and after a rather long time you will have an important amount of useless resources used by these connections.In this article I will explain you how to deal with it.

Befor

I guess before using IQueryable in your DAL (Dat... Continue reading »
1 2