views:

57

answers:

1

Hello,

how can I dispose an <asp:ObjectDataSource>? I mean, there is no code behind and in aspx file there is this:

<asp:ObjectDataSource ID="CategoryDataSource" runat="server" 
    SelectMethod="GetCategoriesFilter" 
    TypeName="BLL.CategoryBLL">
</asp:ObjectDataSource>

Class BLL.CategoryBll implements IDisposable. Do I have to dispose it?

+4  A: 

It is disposed automatically.

"The ObjectDataSource control will create an instance of the source object, call the specified method, and dispose of the object instance all within the scope of a single request, if your object has instance methods instead of static methods."

Data Source Controls at www.asp.net

since you are using iDisposable

"The ObjectDisposing event is always raised before the instance of the business object is discarded. If the business object implements the IDisposable interface, the Dispose method is called after this event is raised."

MSDN ObjectDisposing event

tentonipete