[英]C# Entity Framework 6 - How to handle multiple schemas that have same table names
I'm using C# Entity Framework 6 and I have a database with multiple schemas, in those schemas I have tables with the same names.我正在使用 C# Entity Framework 6 并且我有一个包含多个模式的数据库,在这些模式中我有同名的表。 For example:例如:
I have a single project for all of my database objects with this structure:我的所有数据库对象都有一个具有以下结构的项目:
Project Name = Storm.API.Data
In this project I have folders with the schema names: "Availability", "Rates".
In each folder I have the proper 'edmx' file.
When I run my project I'm getting this error:当我运行我的项目时,我收到此错误:
Schema specified is not valid. Errors:
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM
type 'Hotel'. Previously found CLR type 'Storm.API.Data.Rates.Hotel',
newly found CLR type 'Storm.API.Data.Availability.Hotel'.
The only solution I came up with is to separate the schemas to different project, but since I have more than 2 schemas I don't want to create so many project just for that.我想出的唯一解决方案是将模式分离到不同的项目,但由于我有 2 个以上的模式,我不想为此创建这么多项目。
Is there another solution that will enable me to have all schemas under the same project without this error ?是否有另一种解决方案可以让我在同一个项目下拥有所有架构而不会出现此错误?
You can:你可以:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.