简体   繁体   中英

Am I required to put multiple Entity Framework Models in their own projects in the same solution?

I am using Entity Framework 6 in a Windows Form application. The problem is that I have to connect to 4 different databases with almost identical tables. Each year we rollover the databases and allow users in the current year to load 3 previous years of data for some of the data grid views. I am using the database first method and when I add subsequent Models to the same Models project it removes the duplicate named classes from the Model previously added. Using different projects for each model seems to fix this but is there another way?

One way to resolve this is to create each of your models within a separate folder. By default, Visual Studio creates classes in a namespace corresponding to the folder in which they are created. Creating each model in a separate folder should create each model in a separate namespace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM