「タイプ間の関連付けの主な目的を特定できない」を解決する適切な方法を見つけるのに苦労しています。この関連付けの主な目的は、リレーションシップの流暢なAPIまたはデータのいずれかを使用して明示的に構成する必要があります」Entity Framework
私はのようなエンティティを持っています。
public partial class Document
{
DocumentId {get; set;}
DocumentName{get; set;}
}
public class SpecialDocument
{
DocumentId {get; set;} --> this is actually a foreign key from Document
at the same time it is also the primary key
SpecialDocumentName {get; set;}
}
プロパティにForeignKey属性を追加するような解決策を見つけました。
public partial class SpecialDocument
{
[ForeignKey("Document")]
DocumentId {get; set;)
SpecialDocumentName {get; set;}
}
ただし、問題はクラスが自動生成されることです。edmxファイルを更新するたびに、SpecialDocumentが上書きされるため、ForeginKey属性を再度追加する必要があります。
プロパティへのSpecialDocumentまたはDnyaminc属性アタッチメントの個別の部分クラスに対して何かできることはありますか?ありがとう!