PC Review


Reply
Thread Tools Rate Thread

the difference betweenSqlConnection.IDisposable.Dispose() andSqlConnection.Dispose().

 
 
tangyong
Guest
Posts: n/a
 
      20th Jan 2006
All:
I have a question about the difference between
SqlConnection.IDisposable.Dispose() and SqlConnection.Dispose(). Both of them realize the function of releasing the connection to the ConnectionPool? Do they have the same effection source code? If they are different, who can tell me the differences? If they are same, why MS gives the SqlConnection.IDisposable.Dispose,but only SqlConnection.Dispose() method?
In the MSDN, there are following description about the
SqlConnection.IDisposable.Dispose Method:
"This member supports the .NET Framework infrastructure and is not intended to be used directly from your code." what's the meaning of it?
If the user has called the SqlConnection.IDisposable.Dispose() in the client application, what probem results in? and if there are some problem becomes, then why did MS give us such a method?
in the same, who can tell me the using of
"SqlConnection.ICloneable.Clone "
"SqlConnection.IDbConnection.BeginTransaction" and
"SqlConnection.IDbConnection.CreateCommand"?

Best Regards!!

 
Reply With Quote
 
 
 
 
Lau Lei Cheong
Guest
Posts: n/a
 
      20th Jan 2006
I think if you leave out the interface name, the compiler will choose the
most sensible one for you (usually the object itself's implementation).

If you explicitly selected to call through an interface name, you risk to do
things wrong by chance the object itself choosen to override the method to
do other things. For the purpose of SqlConnection.Dispose(), the object may
have allocated some other resource that require to be freed on dispose, may
need to ensure all datareaders/dataadapeters or so have been properly closed
or so, while IDisposable.Dispose seems to just free up the object (and other
object's in it)'s memory.

<tangyong> glsD:(E-Mail Removed)...
> All:
> I have a question about the difference between
> SqlConnection.IDisposable.Dispose() and SqlConnection.Dispose(). Both of
> them realize the function of releasing the connection to the
> ConnectionPool? Do they have the same effection source code? If they are
> different, who can tell me the differences? If they are same, why MS gives
> the SqlConnection.IDisposable.Dispose,but only SqlConnection.Dispose()
> method?
> In the MSDN, there are following description about the
> SqlConnection.IDisposable.Dispose Method:
> "This member supports the .NET Framework infrastructure and is not
> intended to be used directly from your code." what's the meaning of it?
> If the user has called the SqlConnection.IDisposable.Dispose() in the
> client application, what probem results in? and if there are some problem
> becomes, then why did MS give us such a method?
> in the same, who can tell me the using of
> "SqlConnection.ICloneable.Clone "
> "SqlConnection.IDbConnection.BeginTransaction" and
> "SqlConnection.IDbConnection.CreateCommand"?
>
> Best Regards!!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
subtract the time difference from another time difference =?Utf-8?B?RGFubmlnaXJs?= Microsoft Excel Misc 3 30th Sep 2007 03:47 PM
charting a difference of 2 columns' w/o adding a difference column =?Utf-8?B?V2Fi?= Microsoft Excel Charting 4 27th Jul 2005 02:37 AM
Difference between bin and obj directories and difference between project references and dll references jakk Microsoft ASP .NET 4 22nd Mar 2005 10:23 PM
how do i download difference account messages into difference fol. =?Utf-8?B?Ymx1X2VibHVl?= Microsoft Outlook 1 10th Oct 2004 05:13 PM
Time difference error with no time difference Rob Oldfield Microsoft Windows 2000 Security 0 5th Mar 2004 11:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:09 PM.