Performance question: EF4.1
I am using Repository design pattern "Martin's Fowler" in my application (MVC3, WebForms) also i use "ONLY ONE" DbContext ("Singletone") through out all of my application.
Details: Repository is looks like that,
class Repository<T> : IRepository<T>, IUnitOfWork
only one repository wich i create many more repositories, like so:
class UserRepository {
private IRepository<User> _repository;
//dependency injection via constructor using Ninject
pub开发者_开发百科lic UserRepository(IRepository<User> repository) {
_repository = repository;
}
}
and so on...
What is best practice in these cases, what you are suggestion to make better???
I have to increase my performance and of course to learn the correct way to do it.
Thank you all for the answers.
You are using one context for the whole application = you are done. Your application will not work. You must change it to use a new context instance for each request.
Also I wonder how is your question related to performance and what should your code snippet represent?
精彩评论