列ID出现不止一次在规范? [英] A column ID occurred more than once in the specification?
问题描述
我使用EF 4.1 code第一种方式时与SQL精简4.我没有看到谁拥有id列不止一个,所以我不知道为什么这个错误发生任何模型收到此错误消息。什么会导致这个错误?
I am getting this error message when using EF 4.1 code first approach with Sql compact 4. I don't see any model who has id column more than one so i have no idea why this error occured. What can cause this error ?
编辑:我想specifiy一些额外的东西。数据库中创建是成功的,但模型的创建不是。和异常已引发来自SQLCE的方法。
Edit : I want to specifiy few extra things. Database creating is success but model creating is not. And Exception has been thrown from sqlce methods.
推荐答案
从返回两个或多个具有相同名称的列的SQL查询此问题茎。 SQL将处理精确复制了列名,没有问题,但是C#都将在吐象这样的错误之一。
This issue stems from a SQL query that returns two or more columns that have an identical name. SQL will handle exact duplicate names on columns with no problem but c# will puke errors all over like this one.
例如情况:
TableA
int Id
varchar Name
TableB
int Id
int A_Id
varchar Name
SELECT A.*,
B.Name
FROM TableA A
INNER JOIN TableB
ON B.A_Id = A.Id
ID和名称列将被复制,并导致异常与EF
The Id and Name columns would be duplicated and cause an exception with EF
这篇关于列ID出现不止一次在规范?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!