建筑决定:ASP.NET MVC和放大器;实体框架 [英] Architectural decisions: ASP.NET MVC & Entity Framework

查看:127
本文介绍了建筑决定:ASP.NET MVC和放大器;实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个架构决策的问题:
我们将要建立一个新的应用程序,我们已经决定,我们会(第一个数据库可能)使用的 ASP.NET MVC 实体框架。在第一fases我们只建立定期的浏览器的Web应用程序,但在未来,我们可能会增加移动应用程序。 (SOA?)

I'm having an architectural decision-problem: We're about to build a new application and we've decided we'll be using ASP.NET MVC and Entity Framework (database first probably). In the first fases we'll only be building a web application for regular browsers, but in the future we might add mobile applications. (SOA?)

我的问题是现在是什么将会建立起来的应用程序体系结构的最佳方式?

My question is now what would be the best way to build up the application architecture?

请问这是正确的?


  1. MvcProject

    • 模型

    • 查看

    • 控制器


  • 保存EDMX和T4模板

我一直在寻找的例子,模式和最佳实践,但我似乎无法找到适合恰到好处。

I've been searching for examples, patterns and best practices but I can't seem to find something that fits just right.

感谢您!

推荐答案

我正常组织我的解决方案的方式(的修改的适合的NuGet)

The way I normally structure my solutions (edit adapted for NuGet)


  1. 网站(MVC)

    • 控制器

    • 查看

    • 内容(脚本,CSS,图像等。)


  • 查看模型

  • 模型映射器


  • 规则

  • 本地扩展(Web和一般)



  • 实体模型

  • 数据上下文和配置


  • 扩展(MVC的/网络类)

  • 辅助类
    =属性


  • 扩展

  • 辅助类

依赖流动起来这样的结构,即上面的事情可能引用下面的事情,而不是相反。我也有每个项目单独的测试项目。在某些情况下,我使用的Web /普通类打包带的NuGet和本地存储库外部托管,共享库。

Dependencies flow up this structure, i.e., the things above might reference the things below, but not vice versa. I would also have a separate test project per project. In some cases, I use external, shared libraries for web/general classes packaged with NuGet and hosted on a local repository.

有关手机,如果你正在通过网络去,我会直接构建到使用jQuery Mobile和移动感知的视图引擎的网站。如果你想人,那么我补充一点,可能会或可能不会共享相同的视图模型作为网站的API交付和开发针对API这个结构之外的移动应用的WebAPI层。最有可能的API有它自己的模式,坐落在一个单独的堆栈业务层以上。在我目前的项目中,我们有一个单独的解决方案中的数据,并正在开发独立的解决方案API和网站,通过的NuGet包共享模式。

For mobile, if you're going via the web, I would build that directly into the WebSite using jQuery Mobile and mobile-aware view engines. If you're thinking native, then I'd add a WebAPI layer that may or may not share the same view models as the web site for API delivery and develop the mobile app outside this structure against the API. Most likely the API has it's own models and sits above the business layer in a separate stack. In my current project, we have the data in a separate solution and are developing the API and web site in separate solutions, sharing models via NuGet packages.

这篇关于建筑决定:ASP.NET MVC和放大器;实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆