"Varangian" <of****@gmail.comwrote in message
news:11*********************@42g2000cwt.googlegrou ps.com...
I know that the kind of question below has been asked several
times....however I need a clear answer in my specific situation.
I have 2 methods. One returns an SqlDataReader and the other returns a
DataView. I was considering making them Static methods, so as to avoid
creating instance of the class which takes care of these methods, kind
of a helper class. Since its a web site the method may be accessed by
more than one user at one time....
Static methods which return ADO.NET objects are quite common in DALs
(database abstraction layers) - see the Microsoft DAAB for examples of
this...
the question is would it improve the performance if using Static method
in this case?
Not really - in fact, probably not at all...
Would it be a problem if using Static methods at all?
No, so long as you realise that any static variables will be shared across
multiple instances. This may or may not matter... E.g. if your site uses
only one SQL connection string, then it won't matter if it's shared across
multiple instances, as it will always be the same... However, if you have
other static variables which differ per session, then you will have serious
problems... :-)
All my DAL methods are static because it's a bit less coding not to have to
do class instantiation every time...