如何解决无效的列名鉴别器
好的。我已经在这个街区周围几次了。我有一些继承自实体框架代码优先类的类,我重写了这些类以消除继承。
但是,当我尝试通过实体框架读取未继承的表时遇到这个奇怪的错误,在表中定义了一个主键,并且在 cs 代码中使用 [key] 标记标识了该主键.
这是 cs 实体框架代码:
namespace Entities
{
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
[Table("tblMember")]
public partial class tblMember
{
[Key]
[StringLength(50)]
public string CN { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int MemberUID { get; set; }
[required]
[StringLength(1024)]
public string Password { get; set; }
[StringLength(25)]
public string Title { get; set; }
[StringLength(50)]
public string firstName { get; set; }
[StringLength(25)]
public string middleName { get; set; }
[StringLength(50)]
public string lastName { get; set; }
[required]
[StringLength(400)]
public string eMail { get; set; }
[required]
[StringLength(64)]
public string GUID { get; set; }
public bool eMail_verified { get; set; }
[Column(TypeName = "smalldatetime")]
public DateTime dtRegDate { get; set; }
[StringLength(50)]
public string orgName { get; set; }
[StringLength(50)]
public string orgStreet1 { get; set; }
[StringLength(50)]
public string orgStreet2 { get; set; }
[StringLength(50)]
public string orgCity { get; set; }
[StringLength(50)]
public string orgProvince { get; set; }
[StringLength(53)]
public string orgCountry { get; set; }
[StringLength(20)]
public string orgPostal { get; set; }
[StringLength(25)]
public string HomeTelephone { get; set; }
[StringLength(25)]
public string WorkTelephone { get; set; }
[StringLength(50)]
public string billName { get; set; }
[StringLength(50)]
public string billStreet1 { get; set; }
[StringLength(50)]
public string billStreet2 { get; set; }
[StringLength(50)]
public string billCity { get; set; }
[StringLength(50)]
public string billProvince { get; set; }
[StringLength(53)]
public string billCountry { get; set; }
[StringLength(20)]
public string billPostal { get; set; }
[StringLength(250)]
public string pwdQuestion { get; set; }
[StringLength(250)]
public string pwdAnswer { get; set; }
public bool canReview { get; set; }
public bool IMV_Registered { get; set; }
public int TimeZoneID { get; set; }
public decimal TimeZoneOffset { get; set; }
[StringLength(11)]
public string tm_NPI_Number { get; set; }
public bool tm_bHashedPassword { get; set; }
[StringLength(10)]
public string tm_PasswordSalt { get; set; }
public int? tm_NPI_SourceID { get; set; }
public virtual tblMemberNPI_Source tblMemberNPI_Source { get; set; }
}
}
这是试图从表中取出成员的代码:
var objJunk = from mem in dbContext.tblMembers
where mem.MemberUID == objRpm.rcm_MemberUID
select mem;
string strJunk = objJunk.ToString();
SELECT
[Extent1].[discriminator] AS [discriminator],[Extent1].[CN] AS [CN],[Extent1].[MemberUID] AS [MemberUID],[Extent1].[Password] AS [Password],[Extent1].[Title] AS [Title],[Extent1].[firstName] AS [firstName],[Extent1].[middleName] AS [middleName],[Extent1].[lastName] AS [lastName],[Extent1].[eMail] AS [eMail],[Extent1].[GUID] AS [GUID],[Extent1].[eMail_verified] AS [eMail_verified],[Extent1].[dtRegDate] AS [dtRegDate],[Extent1].[orgName] AS [orgName],[Extent1].[orgStreet1] AS [orgStreet1],[Extent1].[orgStreet2] AS [orgStreet2],[Extent1].[orgCity] AS [orgCity],[Extent1].[orgProvince] AS [orgProvince],[Extent1].[orgCountry] AS [orgCountry],[Extent1].[orgPostal] AS [orgPostal],[Extent1].[HomeTelephone] AS [HomeTelephone],[Extent1].[WorkTelephone] AS [WorkTelephone],[Extent1].[billName] AS [billName],[Extent1].[billStreet1] AS [billStreet1],[Extent1].[billStreet2] AS [billStreet2],[Extent1].[billCity] AS [billCity],[Extent1].[billProvince] AS [billProvince],[Extent1].[billCountry] AS [billCountry],[Extent1].[billPostal] AS [billPostal],[Extent1].[pwdQuestion] AS [pwdQuestion],[Extent1].[pwdAnswer] AS [pwdAnswer],[Extent1].[canReview] AS [canReview],[Extent1].[IMV_Registered] AS [IMV_Registered],[Extent1].[TimeZoneID] AS [TimeZoneID],[Extent1].[TimeZoneOffset] AS [TimeZoneOffset],[Extent1].[tm_NPI_Number] AS [tm_NPI_Number],[Extent1].[tm_bHashedPassword] AS [tm_bHashedPassword],[Extent1].[tm_PasswordSalt] AS [tm_PasswordSalt],[Extent1].[tm_NPI_SourceID] AS [tm_NPI_SourceID],[Extent1].[projectId] AS [projectId]
FROM [dbo].[tblMember] AS [Extent1]
WHERE ([Extent1].[discriminator] IN (N'newRybbonMember',N'tblMember')) AND ([Extent1].[MemberUID] = @p__linq__0)
不确定它到底是从哪里得到 newRybbonMember 或 projectId 的,因为它们都不在 tblMember 定义中。
任何想法将不胜感激。 TIA,
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。