I am trying to learn how to use dependency injection and Ninject. I've been reading blog posts on the topic and Mark Seeman's book "Dependency Injection in .NET". While I have a general understanding of DI, I have troubles understanding how to organize code in a n-tier web application.
我正在尝试学习如何使用依赖注入和Ninject。我一直在阅读有关该主题的博客文章和Mark Seeman的书“.NET中的依赖注入”。虽然我对DI有一个大致的了解,但我很难理解如何在n层Web应用程序中组织代码。
Does anyone know of a project sample that I can download, or a blog post to review? Even better if the sample is based on Ninject and MVC3.
有谁知道我可以下载的项目样本,还是要审阅的博客文章?如果样本基于Ninject和MVC3,那就更好了。
2 个解决方案
#1
4
NerdDinner is a sample ASP.NET MVC project, and it has been updated to MVC 3: http://nerddinner.codeplex.com/
NerdDinner是一个示例ASP.NET MVC项目,它已更新为MVC 3:http://nerddinner.codeplex.com/
There are modified versions of the old MVC 2 version that use Ninject and Unity for dependency injection: http://nerddinneraddons.codeplex.com/ The author of those projects provided a different sample application using MVC 3 and Entity Framework 4.1: http://efmvc.codeplex.com/ but used AutoFac rather than Ninject for dependency injection.
旧的MVC 2版本的修改版本使用Ninject和Unity进行依赖注入:http://nerddinneraddons.codeplex.com/这些项目的作者使用MVC 3和Entity Framework 4.1提供了不同的示例应用程序:http:/ /efmvc.codeplex.com/但使用AutoFac而不是Ninject进行依赖注入。
#2
3
There's S#arp Lite, a light version of S#arp Architecture recently started by S#arp Architecture's original author.
S#arp Lite是最近由S#arp Architecture的原作者创建的S#arp架构的简易版本。
His introductory blogposts:
他的介绍博客:
- Introducing S#arp Lite ...S#arp Architecture's pompous little sister
- S#arp Lite: The Basics
介绍S#arp Lite ... S#arp Architecture的华丽小妹妹
S#arp Lite:基础知识
#1
4
NerdDinner is a sample ASP.NET MVC project, and it has been updated to MVC 3: http://nerddinner.codeplex.com/
NerdDinner是一个示例ASP.NET MVC项目,它已更新为MVC 3:http://nerddinner.codeplex.com/
There are modified versions of the old MVC 2 version that use Ninject and Unity for dependency injection: http://nerddinneraddons.codeplex.com/ The author of those projects provided a different sample application using MVC 3 and Entity Framework 4.1: http://efmvc.codeplex.com/ but used AutoFac rather than Ninject for dependency injection.
旧的MVC 2版本的修改版本使用Ninject和Unity进行依赖注入:http://nerddinneraddons.codeplex.com/这些项目的作者使用MVC 3和Entity Framework 4.1提供了不同的示例应用程序:http:/ /efmvc.codeplex.com/但使用AutoFac而不是Ninject进行依赖注入。
#2
3
There's S#arp Lite, a light version of S#arp Architecture recently started by S#arp Architecture's original author.
S#arp Lite是最近由S#arp Architecture的原作者创建的S#arp架构的简易版本。
His introductory blogposts:
他的介绍博客:
- Introducing S#arp Lite ...S#arp Architecture's pompous little sister
- S#arp Lite: The Basics
介绍S#arp Lite ... S#arp Architecture的华丽小妹妹
S#arp Lite:基础知识