I'm implementing a DAL using the Entity Framework. We have some DAL classes (I call them repositories) instantiating or receiving a context by parameter every time a method is called. I don't like that kind of behavior; I'm not documented about this issue but my common sense says me that context's instantiation consumes too much system resources. So:
- Is context's instantiation expensive?
- If you've answered "yes" to 1, how would you tackle this problem from a design viewpoint?
- If you've answered "yes" to 1, how would you implement the solution in C#?
- Which approach do you recommend to implement a DAL for a web application?