A New Internet Library: Add Your Website/Blog or Suggest A Website/Blog to our Free Web Directory http://anil.myfunda.net.

Its very simple, free and SEO Friendly.
Submit Now....

Tuesday, August 19, 2008

ASP.NET MVC Tip #34 - Dispose of Your DataContext (or Don't)

In this tip, I demonstrate how you can dispose of a DataContext within an ASP.NET MVC controller. Next, I argue that there is no compelling reason to do this. Several people have emailed me recently with the same question about whether or not it is important to call Dispose() on the DataContext object. In all of the code samples that I write, I create an instance of a DataContext object, but I never properly dispose of it. Is this wrong? The DataContext class implements the IDisposable interface. In general, if a class implements the IDisposable interface, then that is good evidence that you should call Dispose(). But keep reading. Classes that implement the IDisposable interface typically use resources that cannot be cleaned up by the .NET...(read more)

Source Click Here.

No comments:

Post a Comment

Post your comments here:

Originals Enjoy