Enterprise Data Access Block and .NET Web Services

K

kellygreer1

I'm working on some internal company web services and I have a
question about resource management within the Enterprise Data Access
Block.

I have about 20 methods which look similar to the one below:
[WebMethod]
public DataSet GetUserDataByGroup(int groupId)
{
string procName = "sp_GetUserDataByGroup";
return DatabaseFactory.CreateDatabase().ExecuteDataSet(procName,
groupId);
}

My question is what happens to the resources created in
DatabaseFactory? Are they disposed of properly? Will I run out of
connections/resources? If this is a bad way to write these?

Thanks,
Kelly Greer
(e-mail address removed)
change nospam to yahoo
 
N

Nicholas Paldino [.NET/C# MVP]

Kelly,

Well, the Enterprise Library Blocks come with source code, so you should
be able to determine pretty quickly if the resource are disposed of
correctly or not.

To answer your question, yes, they are. The ExecuteDataSet method will
open the connection, run the stored procedure, and then populate a data set
and return it. There should be a using statement in the code that you see
for the database connection that is used to populate the data set.
 
K

kellygreer1

Kelly,

Well, the Enterprise Library Blocks come with source code, so you should
be able to determine pretty quickly if the resource are disposed of
correctly or not.

To answer your question, yes, they are. The ExecuteDataSet method will
open the connection, run the stored procedure, and then populate a data set
and return it. There should be a using statement in the code that you see
for the database connection that is used to populate the data set.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


I'm working on some internal company web services and I have a
question about resource management within the Enterprise Data Access
Block.
I have about 20 methods which look similar to the one below:
[WebMethod]
public DataSet GetUserDataByGroup(int groupId)
{
string procName = "sp_GetUserDataByGroup";
return DatabaseFactory.CreateDatabase().ExecuteDataSet(procName,
groupId);
}
My question is what happens to the resources created in
DatabaseFactory? Are they disposed of properly? Will I run out of
connections/resources? If this is a bad way to write these?
Thanks,
Kelly Greer
(e-mail address removed)
change nospam to yahoo

Ah. Ok. I think I understand the using / IDisposable stuff. Just
wanted to make sure there wasn't something I was missing. Thanks
Nicholas.

Kelly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top