Where to put Entity Framework Data Model in MVC application?

后端 未结 4 1116
囚心锁ツ
囚心锁ツ 2021-02-02 15:25

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

-App_data
-Content
-Controllers
    HomeController.cs
-Models
    Accou         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-02 16:13

    My opinion is that you should create

    1. a separate project for domain objects, datacontracts etc. etc... Like MyProject.Infrastructure including many folders like DataContracts, Model, Exceptions etc.
    2. a separate project for DataAccess wich contains the DBContexts and the Repositories, this way you can easily manage migrations later on

提交回复
热议问题