Static Methods in BLL

G

Guest

Hi;

I am developing an 3 tiered application. And my user interface is an ASP.NET
web application. My methods in BLL only uses own parameters and DAL. Now my
methods are not static. I heard that static methods are dangerous in ASP.NET
because ASP.NET applications are multi thread applications.
I use methods like that:
CustData cd = (new BLL.CustSystem()).GetCustomer(custid);
(new BLL.CustSystem()).UpdateCustomer(cd);
......
I review duwamish and I saw that it is like my application.

Can I make my methods static? Is it dangerous? If no, will it be better?

Thanks in advance.
 
S

Steven Cheng[MSFT]

Hi Senol,

Welcome to ASP.NET newsgroup.
As for the static class methods. I don't think they'll involve concurrent
issues unless you've explicitly implement them as context awared. Yes, the
ASP.net is a service application which will have multi concurent threads
running at the same time, however, this doesn't means that all the static
class methods will cause concurrent issu.e As for BBL components, I think
it is quite normal that we implement those operations as static class
methods since static methods's calling will have better performance than
constructor a new instance when using instance method.

Whether it'll cause concurrent issue dependes on how you implement your
static methods. If you make it context awared , for example define some
static variables which will be accessed concurrently, then we should take
care of that. Otherwise, it's ok to use static class methods.

In addition, in some large enterprise( NTIER) application, we create
separate BBL or DAL component instance to do operations because those
component may contains many context awared member datas such as transaction
or security context .... which are not convenient to maintain through
static methods.

Thanks,


Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
E

Ersin Gençtürk

Selam senol,

It is not dangerous.I am using this type of architecture for 2,5 years.As
Steven said , if your functions are seperate from each other there is no
need to worry about.Also , your performence will be better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top