Static data access method vs non-static method

  • Thread starter Thread starter CW
  • Start date Start date
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
 
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.
 
Back
Top