DAL...should the methods be static?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • H

    #1

    DAL...should the methods be static?

    In my BusinessLogicLa yer, there are many places where I call the
    DataAccessLayer .

    Is it better to have static methods in my DAL that are lock()'ed and
    called directly from my BLL (thus the CLR takes care of concurrency)
    or should I have public methods and create an instance of my DAL each
    time it is used (thus let SQL Server take care of concurrency)?

    adv-thanks-ance...
  • Just Me

    #2
    Re: DAL...should the methods be static?

    The only reason you need to lock them is if they are making use of a static
    variable which you should avoid at all costs.

    I have used static methods extensively in my DAL without problems in a multi
    user environment.


    "H" <halukdotcom@gm ail.comwrote in message
    news:cfcc8d02-c4d4-4576-b842-0d8e09f7c477@8g 2000hse.googleg roups.com...
    In my BusinessLogicLa yer, there are many places where I call the
    DataAccessLayer .
    >
    Is it better to have static methods in my DAL that are lock()'ed and
    called directly from my BLL (thus the CLR takes care of concurrency)
    or should I have public methods and create an instance of my DAL each
    time it is used (thus let SQL Server take care of concurrency)?
    >
    adv-thanks-ance...

    Comment

    • HelloCode

      #3
      Re: DAL...should the methods be static?

      On 3ÔÂ22ÈÕ, ÏÂÎç8ʱ18·Ö, H <halukdot...@gm ail.comwrote:
      In my BusinessLogicLa yer, there are many places where I call the
      DataAccessLayer .
      >
      Is it better to have static methods in my DAL that are lock()'ed and
      called directly from my BLL (thus the CLR takes care of concurrency)
      or should I have public methods and create an instance of my DAL each
      time it is used (thus let SQL Server take care of concurrency)?
      >
      adv-thanks-ance...
      if you static methods use different connection is no problem.

      Comment

      • Mark Rae [MVP]

        #4
        Re: DAL...should the methods be static?

        "Just Me" <news.microsoft .comwrote in message
        news:OlH$OtDjIH A.2084@TK2MSFTN GP02.phx.gbl...
        I have used static methods extensively in my DAL without problems in a
        multi user environment.
        Me too.


        --
        Mark Rae
        ASP.NET MVP


        Comment

        Working...