What are the implications (in each case) of declaring a database context ex: mydbEntities as either:
public static mydbEntities db = new mydbEntities ();
public mydbEntities db = new mydbEntities ();
private static mydbEntities db = new mydbEntities ();
private mydbEntities db = new mydbEntities ();
I'm using ASP.NET MVC 2. Thank you!
How to Inject HTML on ASP.NET MVC master page
1:Adding a custom httpmodule to route to MVC or custom handler selectively
staticwould be very very bad here. Multiple websites, Single sign-on designData-context does not play nicely with threading, plis you want to throw it away each time to avoid overuse. How to check the Condition hereYou could use a static property this relates to the current http context. Routing based on requested datatype in ASP.NET MVCThat might make sense. jquery selection problemThen it is just a public static property.. ASP.net MVC - Stop page rendering until JQuery finished Many people prefer things like IOC and instance-based contexts, however; or contexts this sit behind the storage interface. Tricking ASP.NET into Thinking Request is Ajax Request for jQuery File UploadThe choice is yours.. Note: ananother option is thread-static, although it should not be assumed this all of your request is serviced by the same thread. So don't did this either..