C# 从 Monorail 到 ASP.Net MVC
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
From Monorail to ASP.Net MVC
提问by Cheekysoft
The last time I took on a non-trivial .Net/C# application I used Castle Monorail and, on the whole, enjoyed the experience. Early-access/preview releases of .Net MVC were not yet available. Many "Microsoft shops" will now find the "official" solution more appealing. Has anyone gone from Monorail to .Net MVC.
上次我使用非平凡的 .Net/C# 应用程序时,我使用了 Castle Monorail,总的来说,我很享受这种体验。.Net MVC 的早期访问/预览版本尚不可用。许多“微软商店”现在会发现“官方”解决方案更具吸引力。有没有人从 Monorail 转到 .Net MVC。
How did you find the switch?
What are the biggest differences, presently?
你是怎么找到开关的?
目前最大的区别是什么?
回答by Mike
While I haven't made the switch yet, I have developed on both platforms and have been doing some pre-switch analysis.
虽然我还没有进行切换,但我已经在两个平台上进行了开发,并且一直在做一些切换前的分析。
It looks like the biggest difference would be the View Engines. Our Monorail stuff uses the Brail view engine while asp.net mvc comes (stock) with a webforms like view engine. There are other view engines in MvcContrib which could help in this area, though.
看起来最大的区别是视图引擎。我们的 Monorail 东西使用 Brail 视图引擎,而 asp.net mvc 带有(库存)像视图引擎这样的网络表单。不过,MvcContrib 中还有其他视图引擎可以在这方面提供帮助。
Also ViewComponents and view "helpers" seem to be handled quite differently the two frameworks.
此外,两个框架对 ViewComponents 和视图“助手”的处理方式似乎完全不同。
回答by Dale Ragan
I have made the switch, since you pointed out it will be the preferred way for microsoft shops. The switch was pretty trivial and as Mike pointed out it ships with the webform view engine as the default, but like Mike also said you can still take advantage of the views you wrote in brail and nvelocity with the MvcContribproject. ASP.NET MVC, doesn't tie you to a direct ViewEngine, you can use any ViewEngine you want. I don't necessarily think this is a difference.
我已经进行了转换,因为您指出这将是微软商店的首选方式。切换非常简单,正如 Mike 指出的那样,它默认附带 webform 视图引擎,但就像 Mike 也说的那样,您仍然可以利用您在mvcContrib项目中在 brail 和 nvelocity 中编写的视图。ASP.NET MVC 不会将您绑定到直接的 ViewEngine,您可以使用任何您想要的 ViewEngine。我不一定认为这有什么不同。
The biggest difference I found was grouping my controllers and views. In MonoRail you could do this easily with the ControllerDetails attribute, I was able to easily get around this limitation by coding my own, but wish the functionality was built in. I did it by creating my own ViewLocator and creating a ActionFilterAttribute.
我发现的最大区别是将我的控制器和视图分组。在 MonoRail 中,您可以使用 ControllerDetails 属性轻松完成此操作,我可以通过自己编写代码轻松绕过此限制,但希望功能是内置的。我通过创建自己的 ViewLocator 和 ActionFilterAttribute 来实现的。
回答by Brad Wilson
The ASP.NET MVC team is still making changes before v1.0, so now's a good time to provide feedback.
ASP.NET MVC 团队在 v1.0 之前仍在进行更改,因此现在是提供反馈的好时机。
Also, be aware that there are more frequent releases on CodePlex, while the home page on www.asp.net still links to Preview 3.
另外,请注意CodePlex上有更频繁的发布,而 www.asp.net 上的主页仍然链接到 Preview 3。
回答by William Yeung
I am a monorail user, so far I still feel more comfortable on MonoRail + ActiveRecord due to the convenience built at ActiveRecord ARSmartDispatchController. However have to say MonoRail does not have a good documentation base so far (I am one of those should be blamed as the community participant who didn't help enough to write the docs)
我是 monorail 用户,由于 ActiveRecord ARSmartDispatchController 内置的便利性,到目前为止我仍然对 MonoRail + ActiveRecord 感觉更舒服。然而不得不说,到目前为止,MonoRail 没有一个好的文档基础(我是其中之一,应该被指责为社区参与者,他没有提供足够的帮助来编写文档)
As I saw the comments here, ASP.NET MVC use WebForm view engine. I think MonoRail has that too but was being blamed to be quite problematic, so I wonder how is the experience with ASP.NET MVC WebForm- can you use the web form components mostly the way it works as is or you have to basically abandon most of them and stick to more template style approach (like <%= or <%# ?
正如我在这里看到的评论,ASP.NET MVC 使用 WebForm 视图引擎。我认为 MonoRail 也有,但被指责是相当有问题的,所以我想知道 ASP.NET MVC WebForm 的体验如何 - 你能主要使用 web 表单组件的工作方式还是你必须基本上放弃大多数其中并坚持使用更多模板风格的方法(如 <%= 或 <%# ?
回答by c.sokun
Lucky I am not working for an organization use product ship from Microsoft is a needed. So I might not directly answer to your question, However in term of using MonoRail I enjoy every part of the framework although the lack of documentation but test suite are there to guide me through.
幸运的是,我不是为组织工作,需要使用 Microsoft 的产品。所以我可能不会直接回答你的问题,但是就使用 MonoRail 而言,我喜欢框架的每一部分,尽管缺乏文档,但测试套件可以指导我完成。
In short I do not want to invested time in learning new framework although it closely match (each had it own convention) but ASP.NET MVC still lack of some features that I already familiar with such as feature mention by Dale Ragon ControllerDetail, ActiveRecord and so on.
简而言之,我不想花时间学习新框架,尽管它非常匹配(每个框架都有自己的约定)但 ASP.NET MVC 仍然缺乏一些我已经熟悉的功能,例如 Dale Ragon ControllerDetail、ActiveRecord 和很快。