ASP.NET MVC3 多平台支持
在 ASP.NET MVC3 中,构建同时为桌面浏览器和移动设备提供服务的网站的“建议”方式是什么?
简单地构建一个网站并根据浏览器类型“切换”视图的想法在我看来很天真。我的 SWAG 是应该创建一个完全独立的网站,也许在面向桌面的网站和面向移动的网站之间共享公共库。
我这么说并不是因为视图切换是不可能的,而是因为移动设备可能需要完全不同的导航方案(可能还有 POCO-DTO 映射等)。同样,我也不相信 CSS 作为呈现每个平台内容的一种方式,尽管它多年前就以这种方式出售。
那么,这种努力的真实情况是什么呢? MVC3 是否有专门用于此目标的工具,对于认真的开发是否合理?或者我应该坚持我的直觉,拥有一个单独的面向移动设备的网站?
顺便说一句,我对拥有一个支持多个移动设备(iPhone、Droid)的单一移动平台网站的信心要高得多 - 但我更关心移动/桌面二元性。
In ASP.NET MVC3, what is the "suggested" way to build a web site that serves both desktop browsers and mobile devices?
The notion of simply building a single web site and having "switched" views based on browser type - strikes me as naive. My SWAG is that an entirely seperate site should be created, with perhaps common libraries shared between the desktop-oriented site and the mobile-oriented site.
I say this not because view-switching is not possible, but because a mobile device likely requires an entirely different navigation scheme (and possibly POCO-DTO mappings, etc.). Likewise I don't trust CSS as a means to present per-platform content, though it had been sold that way years ago.
So what is the reality of this endeaver? Does MVC3 have a facility specifically for this goal, and is it reasonable for serious development? Or should I stick to my intuition of having a seperate mobile-oriented web site?
Incidently, my confidence of having a single mobile-platform site support multiple mobile devices (IPhone, Droid) is much higher - but I am more concerned about the mobile / desktop duality.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果性能是一个问题,那么移动设备的本机应用程序是最好的选择。如果不是,请尝试 css 和流畅布局。此页面是一个很好的实例:http://css-tricks.com/。
Native app for mobile devices is the best way to go if performance is an issue here. If it's not give a try to css and fluent layout. This page is a great live example: http://css-tricks.com/.
这更多的是一个想法,而不是对你的问题的答案。您是否考虑过实现自定义视图引擎?我读过的一本 MVC 书籍提到,如果您的视图模型将使用 XSLT 呈现,您可以编写自己的视图引擎。同样的想法可以应用于移动设备吗?使用相同的视图模型,但使用不同的引擎渲染结果。
Scott Hanselman 在 2010 年撰写了有关此主题的文章 - 可以在此处找到该文章。
This is more of an idea, rather than an answer to your question. Have you considered implementing a custom view engine? One of the MVC books that I have read, mentioned that you could write your own view engine if your view models will be rendered with XSLT. Can the same idea apply to mobile devices? Use the same view models, but have a different engine render your results.
Scott Hanselman wrote article on this topic in 2010 - it can be found here.