LINQ DataContext

  • Thread starter Mike Gleason jr Couturier
  • 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!
 
C

Cowboy \(Gregory A. Beamer\)

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.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top