放在哪里实体框架数据模型MVC应用程序? [英] Where to put Entity Framework Data Model in MVC application?

查看:234
本文介绍了放在哪里实体框架数据模型MVC应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们考虑默认的ASP.NET MVC应用程序文件夹结构,所以它看起来是这样的:

Lets consider default ASP.NET MVC application folder structure, so it's looks like this:

-App_data
-Content
-Controllers
    HomeController.cs
-Models
    AccountModels.cs
-Scripts
-Views

我的问题是:哪里是把实体框架数据模型(EDMX)文件的最佳地点?它是模型文件夹?是的 - 我们知道,好的解决方案是引进新的项目和它引用MVC应用程序,但现在,让我们忘了这个

My question is: Where is the best place to put Entity Framework Data Model (EDMX) file? Is it Models folder? Yes - we know that good solution is to introduce new Project and reference it to MVC application, but lets forget about this now.

推荐答案

对于一个小项目,它应该是模型的一部分​​。对于较大的产品,所述储存库和关联的模型可以是在一个单独的组件。

For a small project, it should be part of the Model. For a larger product, the repository and the associated model could be in a separate assembly.

这篇关于放在哪里实体框架数据模型MVC应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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