开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜