verwendetes Datenbanksystem: MSSQL auf SQL Server 2008 / aktuelles MS Entity Framework; IDE auf Windows XP SP3
Hallo liebe Community,
ich wende mich an euch mit einem Problem, das mich derzeit schon viele Stunden vergeblicher Arbeit gekostet hat.
Recherchen zu der Exception-Meldung über die gängigen Suchmaschinen blieben leider ohne Erfolg.
Beim schreibenden Zugriff auf eine Tabelle (InvestmentAccount), die mit einer anderen verknüpft ist (Contact), kommt es neuerdings zu einer Ausnahme, die mich vor Rätsel stellt. Da die EdmRelationshipAttribute vom Entity Framework Designer autogeneriert werden, ist es mir schwer vorstellbar dass darin der Fehler liegen soll.
Beim Versuch, ein Projekt nur mit der EDMX und einem einfachstmöglichen Schreibzugriff zu erstellen, klappte dies auch. Ich komme aber nicht dahinter, wo der (vermutliche) Konfigurationsfehler liegt.
Hat jemand diese Fehlermeldung schon einmal erhalten und / oder weiß etwas damit anzufangen? Ich würde es gern verstehen um das zukünfitg vermeiden zu können.
Vielen herzlichen Dank im Voraus!
Ich freue mich über konstruktive Antworten.
#region Navigation Properties
/// <summary>
/// No Metadata Documentation available.
/// </summary>
[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("SvusModel", "FK_InvestmentAccount_Contact", "Contact")]
public Contact Contact
{
get
{
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Contact>("SvusModel.FK_InvestmentAccount_Contact", "Contact").Value;
}
set
{
((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Contact>("SvusModel.FK_InvestmentAccount_Contact", "Contact").Value = value;
}
}
Server Error in '/' Application.
Metadata information for the relationship 'SvusModel.FK_InvestmentAccount_Contact' could not be retrieved. If mapping attributes are used, make sure that the EdmRelationshipAttribute for the relationship has been defined in the assembly. When using convention-based mapping, metadata information for relationships between detached entities cannot be determined.
Parameter name: relationshipName
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Metadata information for the relationship 'SvusModel.FK_InvestmentAccount_Contact' could not be retrieved. If mapping attributes are used, make sure that the EdmRelationshipAttribute for the relationship has been defined in the assembly. When using convention-based mapping, metadata information for relationships between detached entities cannot be determined.
Parameter name: relationshipName
Source Error:
Line 8336: set
Line 8337: {
Line 8338: ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Contact>("SvusModel.FK_InvestmentAccount_Contact", "Contact").Value = value;
Line 8339: }
Line 8340: }
Source File: C:\Dokumente und Einstellungen\PAPE\Eigene Dateien\development\trunk\svus\DataAccess\svus.Designer.cs Line: 8338
Stack Trace:
[ArgumentException: Metadata information for the relationship 'SvusModel.FK_InvestmentAccount_Contact' could not be retrieved. If mapping attributes are used, make sure that the EdmRelationshipAttribute for the relationship has been defined in the assembly. When using convention-based mapping, metadata information for relationships between detached entities cannot be determined.
Parameter name: relationshipName]
System.Data.Objects.DataClasses.RelationshipManager.GetRelatedEndInternal(String relationshipName, String targetRoleName) +8300587
System.Data.Objects.DataClasses.RelationshipManager.GetRelatedReference(String relationshipName, String targetRoleName) +50
Sepron.Svus.DataAccess.InvestmentAccount.set_Contact(Contact value) in C:\Dokumente und Einstellungen\PAPE\Eigene Dateien\development\trunk\svus\DataAccess\svus.Designer.cs:8338
Sepron.Svus.Investments.Account..ctor(String accountNumber, Contact contact, Int32 idInvestmentAccount, EntityCollection`1 investmentEntry, Boolean isAccountForHolding, Session session) in C:\Dokumente und Einstellungen\PAPE\Eigene Dateien\development\trunk\svus\Investments\Account.cs:18
Sepron.Svus.Presentation.Investments.Accounts.FillGridView(IEnumerable`1 items) in C:\Dokumente und Einstellungen\PAPE\Eigene Dateien\development\trunk\svus\Presentation\Investments\Accounts.aspx.cs:131
Sepron.Svus.Presentation.PageWithMainGridView.SetupMainGrid() in C:\Dokumente und Einstellungen\PAPE\Eigene Dateien\development\trunk\svus\Presentation\PageWithMainGridView.cs:77
Sepron.Svus.Presentation.PageWithMainGridView.MainGrid_Load(Object sender, EventArgs e) in C:\Dokumente und Einstellungen\PAPE\Eigene Dateien\development\trunk\svus\Presentation\PageWithMainGridView.cs:20
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.WebControls.DataBoundControl.OnLoad(EventArgs e) +139
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Hallo Observer,
ich arbeite auch mit dem EF, bin aber noch ein Einsteiger.
Vielleicht wurden Beziehungen in der Datenbank geändert. Aktualisiere doch einfach einmal Dein Modell (edmx).
Grüße
Mfg
Michael
PS: Ich stelle nur Fragen, wenn ich in Büchern, im Web und in Foren nichts gefunden habe. Dumme Fragen bitte ich zu entschuldigen!
:] VISUAL STUDIO 2017 + .NET FRAMEWORK 4.5 + SQL-Server 2012 :]
Hallo,
vielen Dank für die Antwort. Das habe ich getan, hatte aber nix gebracht.
Ich habe jedoch den Fehler nun gefunden:
Zu meiner vom EF autogenerierten Klasse hatte ich eine Sohnklasse implementiert, die jedoch in einem anderen Namespace lag.
Offenbar ist es nicht möglich, dass diese Sohnklasse in einem abweichenden Namespace untergebracht ist.
Jetzt habe ich sie (wieder) als partial markiert und in den gleichen Namespace verfrachtet. Nicht schön, aber funktioniert wenigstens 😉