Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dispose
Message
 
 
To
23/10/2008 06:13:47
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Environment versions
Environment:
C# 2.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01356493
Message ID:
01356503
Views:
26
>hi
>I have been told I must call Dispose on my business objects and close the connection, how do I do this? or why should I not do this?
>thanks once again

Please take this with the caveat that I know nothing about Mere Mortals. I can tell you, though, that in C# any class that implements the IDisposable interface -- which MM bizobjs apparently do -- is expected to provide and call a Dispose() method. Implementing IDisposable is an implicit statement that there is something that needs to be disposed. Holding a scarce resource like a database connection would be a typical example of when you would want to do this, rather than waiting for C#'s automatic garbage collection to kick in. When you are done with your bizobj, simply call this.Dispose(). The Dispose method should check for a valid connection and close it if found. If you are managing any other resources, release them, too. HTH....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform