Microsoft Data access application block - static methods

  • Thread starter Thread starter Raagz
  • Start date Start date
R

Raagz

Hi,

I came across the Microsoft Data access applicaiton block,
and noticed that all the methods in the sqlhelper class are static.

Suppose if i use the Microsoft DAL block in an ASP.NET application
will having static methods affect when muliple users use the
applcation.

I have read that we need to use lock (C#) keyword if we use static
variables in ASP.NET applicaton.

Please comment.

Raagz
 
I came across the Microsoft Data access applicaiton block,
and noticed that all the methods in the sqlhelper class are static.

That's right - saves having to instantiate the class explicitly.
Suppose if i use the Microsoft DAL block in an ASP.NET application
will having static methods affect when muliple users use the
applcation.

Not in the slightest.
I have read that we need to use lock (C#) keyword if we use static
variables in ASP.NET applicaton.

Static variables are not the same as static methods.
 
Static methods are simply compiled once and left in memory, leaving you with
no need to create an object. They are not the same as static variables, which
should be locked when changed to ensure another person is not changing (I am
sure this is what you are thinking about).

I have used the MS DAL (DAAB) on many apps, although I would download the
newer Enterprise Library version if I were developing a new application.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top