Sitecore 和 MVC3
我正在使用 Sitecore 启动一个项目,我一直在寻找不同的可能性。我有一些 MVC 经验,但我不明白为什么你想将其与 Sitecore (6.4) 结合起来。
- 有什么好处?是否有任何实现(代码)的示例(而不是配置:http://sdn.sitecore.net/upload/sitecore6/64/integrating%20an%20asp.net%20mvc%20web%20application%20in%20sitecore%20cms-usletter.pdf) ?
- 或者为什么我不应该将 MVC 与 Sitecore 一起使用?
那么什么时候应该将 Sitecore 6.4 与 MVC3 一起使用,什么时候不应该使用呢?有没有任何(代码)示例?
提前致谢!
I am starting a project with Sitecore, I have looked for different possibilities. I have some experience with MVC but I don't understand why you want to combine this with Sitecore (6.4).
- What are the benefits? Are there any examples of the implementation of (the code of) this (not the configuration on: http://sdn.sitecore.net/upload/sitecore6/64/integrating%20an%20asp.net%20mvc%20web%20application%20in%20sitecore%20cms-usletter.pdf)?
- Or why shouldn't I use MVC with Sitecore?
So when should I use Sitecore 6.4 with MVC3 and when not? And are there any (code)examples?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经使用 Sitecore 成功实施了自己的 MVP 实施。 MVP 比 MVC 更宽容一些,并且可以轻松集成到基于 Web 表单的应用程序中。我使用 T4 模板直接从 Sitecore 模板生成模型,使用内置的 Web 服务,效果非常好。
Sitecore 尚不支持 MVC(在推荐版本中),并且尝试使其工作可能不值得付出努力。我相信他们正在开发一个正确支持 MVC 的版本,这可能是您提供的链接。然而,它可能也是非常新的,并且旧版本中有很多依赖于 Web 表单的功能。我希望看到它在 MVC 下以官方身份运行几次迭代。
实现 MVC 和 MVP 等模式都是为了分离关注点并使表示层单元可测试。它还鼓励更优雅的设计。
阅读文档后,您会发现这是与 MVC 并行运行 Sitecore 的指南。我看不到任何有关 Sitecore 的新渲染机制的信息,这会使除 Web 表单之外的任何内容中的模板变得困难。然而,它允许您使用 Sitecore API 通过 MVC 视图构建您自己的模板,但您将失去通过 Web 表单获得的开箱即用的内联编辑功能。
I've successfully implemented my own MVP implementation using Sitecore. MVP is a bit more forgiving than MVC, and can easily be integrated into web forms based applications. I used T4 templates to generate Models directly from Sitecore templates using the built-in webservices which worked really well.
Sitecore doesn't support MVC yet (in the recommended release), and trying to make it work is probably not worth the effort. I believe they are working on a version that supports MVC properly, which may be the link you provided. However it's probably also very new and there is a lot of functionality in the old version that relies on web forms. I'd like to see it working under MVC in an official capacity for a few more iterations.
Implementing patterns such as MVC and MVP are all about separating concerns and making your presentation layer unit testable. It also encourages more elegant design.
Just reading the doc it looks like this is a guide for running Sitecore in parallel with MVC. I can't see anything about new rendering mechanisms for Sitecore, which would make templating difficult in anything other than web forms. It would however allow you to use the Sitecore API to build your own templates via MVC Views, but you would loose the inline editing functionality that you get out-of-the-box with web forms.
使用 mvp 可能是最简单的方法。我在此处写了一篇关于它的博客文章。
不过,我们之前已经将 MVC3 与 Razor 一起使用过,而且效果非常好。唯一的问题是您失去了使用页面编辑模式的能力,因为您必须对 sitecore 进行一些黑客攻击才能使其正常工作。如果人们感兴趣的话,我正在考虑写一篇关于它的博客文章。
Using mvp is probably the simplest way to go. I wrote a blog post about it here.
However, we have used MVC3 with Razor before and it worked very well. The only issue is you lose the ability to use Page edit mode as you have to do some hacking of sitecore to get it to work. I'm contemplating writing a blog post about it if people are interested.
只是为了跟进.. MVC 现在在 6.6 中得到支持,该版本将于 2012 年 11 月 5 日发布。我们刚刚在 Sitecore 研讨会上看到了 John West 的演示,它看起来是一个很棒的框架。它最好的事情之一是您可以将 MVC 与 Web 表单并行使用。您不必全力支持 MVC,您可以在 MVC 中慢慢迁移或构建新组件,同时仍然在整个站点中运行 Web 窗体。
Just to follow up.. MVC is now supported in 6.6, which will be released on November 5th 2012. We just saw a demo from John West at the Sitecore Symposium and it looks like a great framework. One of the best things about it is that you can use MVC side-by-side with Web Forms. You don't have to make an all-in bet for MVC, you can just slowly migrate or build new components in MVC, while still running Web Forms throughout your site.