LINQ DataContext Interview Questions and Answers


 

Interview Question in LINQ DataContext

How can I keep entities cached beyond the lifetime of a single DataCon

 How can I keep entities cached beyond the lifetime of a single DataContext?  I want to keep a collection of entities in a cache so that all subsequent requests can read from this cache instead of going back to the database each time.

Should I keep my DataContext in a static/global/shared variable?

Should I keep my DataContext in a static/global/shared variable?

Should I create a new DataContext in every business logic method?

 Should I create a new DataContext in every business logic method?