Geeks With Blogs
Scott Kuhl Warning: I may have no idea what I am talking about!

This article shows you how to use a delegate to open your DataReader, ensuring the reader is properly closed when you finish with the page.

In most common data binding scenarios an IDataReader instance is pulled from the DAL, assuming data readers and the data binding are in use, resource releasing is left up to the client. With delegates we can turn this so that a data binding method taking an IDataReader instance as a parameter, is itself given as a parameter to the DAL. With this idea the responsibility of cleanup is up to the DAL, because DAL invokes the delegate instance, waits for it to finish execution and then closes the data reader and the database connection.

Using Delegates with Data Readers to Control DAL Responsibility

Posted on Thursday, January 19, 2006 12:22 PM ASP.NET | Back to top

Comments on this post: Ensure Your DataReader Is Closed

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Scott Kuhl | Powered by: