P
PaulMac
I would like to hear opinions on Web Service App design in terms of where
different developers have placed certain initialization or database
connection code. For example, say we have a Web Service that uses ADO.NET
to connect to a database. Where do you prefer to place the code to connect
and disconnect? Each Web Method? A "global" area like the Web Service
class constructor and destructors (Dispose)? How about somewhere in
Global.ASAX? What if not all Web Methods needed the database connection?
What is optimal in that case?
I'll also add to this discussion that the garbage collection and/or
connection pooling has been an issue for me. There have been problems where
the database engine resource governor has throw an exception. Therefore,
resources need to be released as soon as possible. I cannot follow the
numerous .NET programming examples where objects and connections are made
and aren't explicitly freed (allow the automatic mechanism to clean up).
Paul
different developers have placed certain initialization or database
connection code. For example, say we have a Web Service that uses ADO.NET
to connect to a database. Where do you prefer to place the code to connect
and disconnect? Each Web Method? A "global" area like the Web Service
class constructor and destructors (Dispose)? How about somewhere in
Global.ASAX? What if not all Web Methods needed the database connection?
What is optimal in that case?
I'll also add to this discussion that the garbage collection and/or
connection pooling has been an issue for me. There have been problems where
the database engine resource governor has throw an exception. Therefore,
resources need to be released as soon as possible. I cannot follow the
numerous .NET programming examples where objects and connections are made
and aren't explicitly freed (allow the automatic mechanism to clean up).
Paul