我有這個錯誤,它的竊聽我的地獄已經失去了一天試圖找出它可以有人幫助我請我相信這是與我做的外鍵,但不能弄清楚什麼是錯的。無法理解這與實體框架
概念模型類型'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'的關係。 –