如何组织一个 asp.NET MVC 项目以实现“精简版”应用程序?版本

发布于 2024-08-24 15:33:23 字数 311 浏览 8 评论 0原文

我正在将 Web 表单应用程序迁移到 ASP.NET MVC。将来我们可能希望提供该应用程序的“精简版”。这是一个相当模糊的概念,但我希望底层数据库是相同的,我们只会简化 UI,用户甚至可以在完整版和精简版之间随意切换。

我们显然希望尽可能多地重用,也许使用相同的模型但不同的视图。某些页面将保持完全相同,其他页面可能会被删除或与其他页面合并。

我想要避免的是,如果我们最终决定这样做,那么以这样的方式组织项目,就会很难做这个“精简”版本。此时我能想到的是控制器和视图的区域,按“完整”、“精简”和“共享”组织。

有人有使用 MVC 开发多种应用程序的经验吗?

I am migrating an web forms app to ASP.NET MVC. Down the road we may want to offer a "lite" version of this application. This is a pretty vague concept, but I expect the underlying database would be the same, we would only simplify the UI, and users might even switch at will between the full and lite versions.

We would obviously want to reuse as much as possible, perhaps using the same model but different views. Some pages would remain exactly the same, others might be eliminated or combined with other pages.

What I am wanting to avoid is organising the project in such a way that it makes it hard to do this "lite" version if it eventuates that we decide to do it. At this point all I can think of is having areas for controllers and views, organised by "full", "lite" and "shared".

Does anyone have any experience with multiple flavors of an application using MVC?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忘东忘西忘不掉你 2024-08-31 15:33:23

更好的解决方案是拥有一个自定义母版页和视图,就像您可以为移动应用程序创建自定义条目一样。请参阅此处:

http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx

这个解决方案应该效果很好。

A better solution would be to have a custom Master Page and views much in the way that you can create a custom entry for mobile apps. See here:

http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx

This solution should work very well.

紧拥背影 2024-08-31 15:33:23

我建议查看 ASP.NET MVC 区域 ,并使用部分视图来实现功能。这是针对 MVC 1 的,我相信 MVC 2 支持开箱即用的区​​域。

I would recommend looking at ASP.NET MVC Areas, and using a partial views for functionality. This is for MVC 1, I believe areas are supported out of the box by MVC 2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文