For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > March 2004 > Static data access method vs non-static method









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Static data access method vs non-static method
CW

2004-03-31, 12:44 pm

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


Kevin Spencer

2004-03-31, 1:38 pm

> 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.

"CW" <a> wrote in message news:urYWcI0FEHA.3724@TK2MSFTNGP11.phx.gbl...
> 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
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com