Static data access method vs non-static method

C

CW

When I use a centralized data access component, I often find myself creating
an instance of the data access component and calling its method in a webform
(or from its code behind).

Is there any reason why I shouldn't mark those data access methods static
(or shared in vb.net parlance) and thus allowing me to access them without
having to instantiate the component first?

Thanks in advance

CW
 
K

Kevin Spencer

Is there any reason why I shouldn't mark those data access methods static
(or shared in vb.net parlance) and thus allowing me to access them without
having to instantiate the component first?

Hard to say without looking at the actual code, but I can tell you that we
use a Data Access Layer class that is composed entirely of static methods
and properties, with success.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

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