LINQ DataContext

  • Thread starter Thread starter Mike Gleason jr Couturier
  • Start date Start date
M

Mike Gleason jr Couturier

Hi,

Is there any benefit to store a datacontext singleton in an application
variable?

Should I bother?

Should I just create an instance of my datacontext every time my business
objects need it?

Thanks!
 
Personally, LINQ to SQL is not a good strategy for your Data Access Layer
(DAL) with a web application. I blogged about a way to set up LINQ as a
disconnected DAL on my blog. It is not necessarily the best way, but it
works, if you must use LINQ to directly access the database.

You can store a single context as a singleton, but you end up with a scaling
problem at some time. You also lock up expensive resources. This is why LINQ
is not the best data access technology for a disconnected paradigm, like web
apps.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
Back
Top