Reputation: 23521
(This relates to Microsoft's SitkaSoapService, in the service reference at https://database.windows.net/soap/v1/)
I'm using SitkaSoapServiceClient to access my SQL Data Services database by SOAP.
Should I use a "using" statement every time I use this proxy class? Or does it do its own connection handling in a safe way internally?
I.e. do I need to say:
using (SitkaSoapServiceClient proxy = GetProxy())
proxy.Update(scope, entity);
... or is it safe to say:
GetProxy().Update(scope, entity);
[where GetProxy() returns a SitkaSoapServiceClient object.]
Upvotes: 0
Views: 86
Reputation: 300669
Does the proxy class code compile when wrapped in a using statement? If so, it implements IDisposable
and I'd use it.
EDIT: calling Dispose() should incur little overhead if it does nothing, and if the designer of the class decides at a later date to allocate unmanaged resources you will be protected from a leak.
Upvotes: 0
Reputation: 36679
You should always use using
when the class implements IDisposable, because the author of the class tells you that it contains some resources that should be freed.
Upvotes: 0