更改EDMX文件中的一张表会影响项目中的所有操作.架构无效 [英] Changing one table in EDMX file affect all actions at project. The schema is not valid

查看:47
本文介绍了更改EDMX文件中的一张表会影响项目中的所有操作.架构无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我们正在使用VS2010和MVC3.

该项目运行良好. EDMX模型中有40多个表.我们在EDMX文件上更改了一张表,然后没有任何作用.

所有操作(与更改无关或无关)都会出现此错误:


该方案无效.错误:

该类型没有关键成员.两个RelationshipType作为EntityType必须具有具有BaseType键或键成员的成员.该类型没有关键成员.两个RelationshipType作为EntityType必须具有具有BaseType键或键成员的成员.

说明:运行当前Web请求时出现未处理的异常.检查堆栈跟踪以获取有关错误及其在代码中起源的更多信息.


所有表都有钥匙...

我们正在还原旧的备份,并且工作正常...重建,然后没有任何效果. !!!

任何想法,请先谢谢...


例如:(这是Modelo.designer.cs的一部分)

Hi everyone,

We are using VS2010 and MVC 3.

This project was working fine. With over 40 tables in EDMX Model. We change a one table over EDMX file and then nothing work.

All actions (related or not with change) gives this error:


The scheme is not valid. Errors:

The type has no key member. Both RelationshipType as EntityType must have members with BaseType key or key members. The type has no key member. Both RelationshipType as EntityType must have members with BaseType key or key members.

Description: An unhandled exception when running the current Web request. Check the stack trace for more information about the error and where it originated in the code.


All tables has a key...

We are restoring a old backup, and working fine... rebuild and then nothing work. !!!

Any idea, thank you in advance...


For example: (this is a piece of Modelo.designer.cs)

public ObjectSet<Clientes> Clientes {
get 
{
     if ((_Clientes == null)) 
     {
         _Clientes = base.CreateObjectSet<Clientes>("Clientes"); // ERROR HERE
     }
     return _Clientes;
}
}


模型(EDMX)中所有表的错误相同.我们使用菜单选项执行自定义工具"(或类似于"Ej​​ecutar herramienta personalizada")来重建Model.designer.cs.


Same error for all tables in the Model (EDMX). We are rebuild Model.designer.cs using menu option "execute custom tool" (or similar to "Ejecutar herramienta personalizada")

推荐答案

是的,如果您更改edmx因此,一个表定义被破坏,所有EF方法都将破坏,有时还会出现模糊的错误.因此,对其进行更改以使其固定,并正确定义您的表.听起来您这样做了,而且您的更改很糟糕. 什么都没有做"非常模糊,您是否从那里调试过?如果EF类现在可以正常工作,那么您需要解释有什么问题并可能发布一些代码.
Yes, if you change your edmx so that one table definition is broken, all the EF methods will break, sometimes with vague errors. So, change it so that it''s fixed, and correctly defines your tables. It sounds like you did that, and that your change was bad. ''Nothing works'' is very vague, have you debugged from there ? If the EF classes work now, then you need to explain what is broken and perhaps post some code.


有两个正在构建的ViewModel,并且没有密钥!

这些类是新的控制器,并且所有控制器中均发生错误. (旧的控制器工作正常)
There were two ViewModels under construction and without key!

These classes are a new controllers and the error occurred in all controllers. (the old controllers worked fine)


这篇关于更改EDMX文件中的一张表会影响项目中的所有操作.架构无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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