我有这个错误,它的窃听我的地狱已经失去了一天试图找出它可以有人帮助我请我相信这是与我做的外键,但不能弄清楚什么是错的。无法理解这与实体框架
概念模型类型'socialprofilesModel.FK_Logins_Users'中的Member'Users'在CLR类型'socialprofilesModel.FK_Logins_Users1'中不存在。
说明:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关该错误的更多信息以及源代码的位置。
Exception Details: System.Data.MappingException: The Member 'Users' in the conceptual model type 'socialprofilesModel.FK_Logins_Users' is not present in the CLR type 'socialprofilesModel.FK_Logins_Users1'.
源错误:
Line 22:
Line 23: List<SPLogin> validUser;
Line 24: validUser = socialProfileContext.ValidateUser(txtuserName.Text, txtPassword.Text);
Line 25: if (validUser !=null)
Line 26: {
Source File: c:\Users\dave\Documents\Visual Studio 2012\WebSites\cmsforletsmakeapps\admin\Login.aspx.cs Line: 24
堆栈跟踪:
[MappingException: The Member 'Users' in the conceptual model type 'socialprofilesModel.FK_Logins_Users' is not present in the CLR type 'socialprofilesModel.FK_Logins_Users1'.]
System.Data.Mapping.DefaultObjectMappingItemCollection.GetObjectMember(EdmMember edmMember, StructuralType objectType) +8321746
System.Data.Mapping.DefaultObjectMappingItemCollection.LoadAssociationTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +169
System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +234
System.Data.Mapping.DefaultObjectMappingItemCollection.LoadTypeMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +100
System.Data.Mapping.DefaultObjectMappingItemCollection.LoadEntityTypeOrComplexTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +445
System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +175
System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType cdmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection) +82
System.Data.Mapping.DefaultObjectMappingItemCollection.TryGetMap(String identity, DataSpace typeSpace, Boolean ignoreCase, Map& map) +333
System.Data.Metadata.Edm.ClrPerspective.TryGetTypeByName(String fullName, Boolean ignoreCase, TypeUsage& typeUsage) +91
System.Data.Objects.ObjectContext.GetTypeUsage(Type entityCLRType) +111
System.Data.Objects.ObjectContext.GetEntitySetForNameAndType(String entitySetName, Type entityCLRType, String exceptionParameterName) +30
System.Data.Objects.ObjectContext.CreateObjectSet(String entitySetName) +60
SPDataContext.socialprofilesEntities.get_SPLogins() +102
SPDataContext.EntityFramework.MyContext.ValidateUser(String username, String password) +165
[EntityContextException: ValidateUser failed.]
SPDataContext.EntityFramework.MyContext.ValidateUser(String username, String password) +1442
admin_Login.btnlogin_Click(Object sender, EventArgs e) in c:\Users\dave\Documents\Visual Studio 2012\WebSites\cmsforletsmakeapps\admin\Login.aspx.cs:24
Telerik.Web.UI.RadButton.OnClick(ButtonClickEventArgs e) +134
Telerik.Web.UI.RadButton.RaisePostBackEvent(String eventArgument) +284
Telerik.Web.UI.RadButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +42
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9703558
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
DB编辑请找我的EDMX文件请注意,我只引擎收录它引起的长度将超过什么允许是张贴所以请原谅我,如果不正确的方式。
你能分享你的用户模型的来源吗? –
@MichaelDunlap在栈上做这件事的最好方法是什么 – rogue39nin
如果你使用EF Code-First,你可以分享你的模型的源代码。如果你使用其他的东西,你仍然需要分享'socialprofilesModel'与代码相关的'Users'的关系。 –