Home  /  Questions  /  Question



250   96.9
Jan 25, 2014


db.cs class declaration static in v4 and not static in v4.5

Why did you change the approach of using the singleton pattern framework v4 and declaring db class as static to now in framework v45 declare it as regular class, and then instantiating a different copy as static per type of resource?

I mean one static instantiation for members, another static instantiation for products, etc was there a reason? perhaps you found it to be a performance bottleneck?

Thanks!




508   99.9
Feb 02, 2014
Angel, 

The main reason the static keyword was removed was so it would support multiple database connections concurrently. 
Hope this helps. 

Jack

60   95.3
Feb 11, 2014
i had a working WCF on the localmachine but when uploading to the datacenter it failed

As the class was static it is created when the service is accessed and the DB user specified didn't have access to the DB, this caused the whole service to fail without generating a catchable exception and  the hosting center wouldn't allow me write a trace log via a listener
so made remote debugging a matter of trial an error disabling code till it started to work

using a non static a simple try catch can be used