473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DAL...should the methods be static?

H
In my BusinessLogicLayer, 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...
Mar 22 '08 #1
3 1814
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" <ha*********@gmail.comwrote in message
news:cf**********************************@8g2000hs e.googlegroups.com...
In my BusinessLogicLayer, 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...

Mar 22 '08 #2
On 3ÔÂ22ÈÕ, ÏÂÎç8ʱ18·Ö, H <halukdot...@gmail.comwrote:
In my BusinessLogicLayer, 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.
Mar 22 '08 #3
"Just Me" <news.microsoft.comwrote in message
news:Ol**************@TK2MSFTNGP02.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
http://www.markrae.net

Mar 22 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Neil Zanella | last post by:
Hello, I would like to know whether it is possible to define static class methods and data members in Python (similar to the way it can be done in C++ or Java). These do not seem to be mentioned...
3
by: Steven D'Aprano | last post by:
I've been doing a lot of reading about static methods in Python, and I'm not exactly sure what they are useful for or why they were introduced. Here is a typical description of them, this one...
8
by: Steven Livingstone | last post by:
Anyone able to explain to me why you cannot define an interface that can then be implemented using static methods? I understand the C# CLS states this, but just interested in the reasons behind...
3
by: Jay | last post by:
Why are there static methods in C#. In C++ static was applied to data only (I believe) and it meant that the static piece of data was not a part of the object but only a part of the class (one...
6
by: MSDNAndi | last post by:
Hi, I have a baseclass (non-static) with some static and some non-static methods/fields/properties. In the baseclass in one of the static methods I need to do something like " somelogic...
12
by: chandu | last post by:
hello, i want to know usage of static methods in a class. is it advantageous or disadvantage to use more static methods in a class. thank u
26
by: Cliff Williams | last post by:
Can someone explain the pros/cons of these different ways of creating a class? // 1 function myclass() { this.foo1 = function() {...} } // 2a
2
by: Random | last post by:
Here's a design question I'm curious to know if anyone here has wrestled with before... I'm writing my data access methods in classes in the App_Code directory. I know that I can easily...
15
by: Laser Lu | last post by:
I was often noted by Thread Safety declarations when I was reading .NET Framework Class Library documents in MSDN. The declaration is usually described as 'Any public static (Shared in Visual...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.