可扩展的 ASP.NET MVC Web 应用程序
我需要使用 ASP.NET MVC 3 编写一个完全模块化且可扩展的 Web 应用程序。例如,模块/扩展可以是论坛、博客或内容模块。
我考虑过使用多项目 MVC 区域来实现此目的,因此我有一个 Extensions/
目录,其中包含扩展的 .dll
-s ,并在 Application_Start
上(或者可能在前面的步骤中),它将该目录中的所有扩展加载到当前 AppDomain。
有没有更好的方法来做到这一点?我的意思是,也许根本不使用 MVC 区域?也许使用 MEF?我对 MEF 的经验很少,我想学习,但我只是不知道这是否适合我的项目。也许使用 MVC Areas + MEF?
正如你所看到的,我很困惑,想得到澄清:)
谢谢。
I need to write a web application with ASP.NET MVC 3 that should be completely modular and extensible. A module/extension would be, for example - a forum, a blog or a content module.
I thought about using multi-project MVC areas for this purpose, so I have an Extensions/
directory with the .dll
-s of the extensions, and on Application_Start
(or maybe on an earlier step), it loads all the extensions in that directory to current AppDomain.
Is there any better way to do this? I mean, maybe not using MVC areas at all? Maybe using MEF? I have a very little experience with MEF, and I'd like to learn, but I just don't know if that fits my project. Maybe using MVC Areas + MEF?
As you can see, I'm pretty confused and would like to have a clarification :)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正在研究类似的东西。我还没有开始,但到目前为止我已经阅读了 这个 看起来很有希望。
看来 MVC3 有特定的 IoC 接口,因此您需要将大部分时间花在查看 MVC3+MEF 示例上。一些较旧的示例不太相关。
如果您希望您的视图易于扩展,那么 这似乎是个好主意。
I'm looking into something similar. I've yet to start but so far I've read this which seems promising.
It appears that MVC3 has specific interfaces for IoC, so you want to spend most of your time looking at MVC3+MEF examples. Some of the older examples are less relevant.
If you want your views to be easily extensible then this seems like a good idea.
我已经完成了很多关于将 MEF 与 ASP.NET MVC 结合使用的主题。它工作得很好,但不如 MVCContrib 项目中的可移植区域那么精致。
MVC3 + MEF:http://www.fidelitydesign.net/?p=259
MVC2 + MEF:http://www.fidelitydesign.net/?p=159
I've done quite a few topics on using MEF with ASP.NET MVC. It works quite well, but it is not as polished as say portable areas in the MVCContrib project.
MVC3 + MEF: http://www.fidelitydesign.net/?p=259
MVC2 + MEF: http://www.fidelitydesign.net/?p=159