简体   繁体   English

在两个不同的EDMX映射中使用一个表/模型

[英]Using one table/model in two different EDMX maps

So I had a functioning Ado.Net project with a mysql database using EntityFramework. 所以我有一个运行正常的Ado.Net项目,使用EntityFramework建立了一个mysql数据库。 I have several tables, all of which had latitude and longitude fields. 我有几个表,所有的表都有纬度和经度字段。 I recently added a coordinate_addresses table, and modified all my existing tables with lat/long fields by replacing said fields with a coordinate_address_id field. 我最近添加了一个ordinate_addresses表,并通过将经纬度/经度字段替换为coordinate_address_id字段来修改所有现有的经/纬度表。 Now, pretty much all of my queries fail with the following error: 现在,几乎所有查询都失败,并显示以下错误:

Schema specified is not valid. Errors: 

The relationship 'myModel.device_locations_ibfk_2' was not loaded because the type 'myModel.coordinate_addresses' is not available.
The following information may be useful in resolving the previous error:
The required property 'device_locations' does not exist on the type 'myNamespace.Database_Maps.coordinate_addresses'.

There are actually several of these errors where the relationship changes but the required property remains the same. 这些错误实际上有几种,它们之间的关系发生了变化,但所需的属性保持不变。 I have entirely recreated my EDMX maps to no success. 我已经完全重新创建了EDMX映射,但没有成功。

If any more information is required I will do my best to provide it! 如果需要更多信息,我会尽力提供!

EDIT: So I have two EDMX files. 编辑:所以我有两个EDMX文件。 When I run custom tool on one, it removes coordinate_addresses from the other. 当我在其中一个上运行自定义工具时,它会从另一个工具上删除axis_addresses。 In effect every time I fixed one EDMX I broke the other. 实际上,每次我修复一台EDMX时,我都会破坏另一本。 Can I not use the same model in two different db connectors? 我不能在两个不同的数据库连接器中使用同一模型吗? Please assist! 请协助!

If your edmx files are in the same namespace, try changing them. 如果您的edmx文件位于同一名称空间中,请尝试更改它们。 chances are custom finds it conflicting to create two objects with the same name in the same namespace. 自定义的机会是发现在同一名称空间中创建两个具有相同名称的对象是冲突的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 查询表不在数据模型Edmx中 - Query Table not in Data Model Edmx 一页上的两个表单,使用ViewModel绑定到不同的模型 - Two forms on one page, with a different model bound to each, using a ViewModel 我如何将EDMX文件中的联结表替换为多对多关系? - How I alternative junction table in EDMX file to many to many Relation between two table in edmx file? EDMX模型的不同代码生成项之间有哪些本质区别? - What are essential differences between the different code generation items for EDMX model? 如何快速找到我的 EDMX 模型中的特定表? - How do I find a specific table in my EDMX model quickly? 我可以从 edmx model 更新数据库表吗? - I can update database table from edmx model? 如何在一个模型中选择不同表的内容 - How to select the content of different table in one model 一个edmx文件,具有不同实现的多个数据库-支持映射详细信息 - One edmx file, multiple databases with different implementation - support mapping details 如何在两个不同域中的两个不同上下文中使用一个表? - How to use one table for two different contexts in two different domains? 使用现有的C#模型类构建实体图(.EDMX) - Using existing C# model classes to build an entity diagram (.EDMX)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM