オブジェクトのリストを含むクラスを含む.dllがあります(これはメタデータからのもので、ソースコードはありません):
public class APIKeyInfo
{
public APIKeyInfo();
public long AccessMask { get; set; }
public List<AccountEntry> Characters { get; set; }
public DateTime Expires { get; set; }
}
public class AccountEntry
{
public AccountEntry();
public long CharacterID { get; set; }
public string Name { get; set; }
... other properties
}
私のコードには、EF Code First を使用してデータベース テーブルを指定する APIKeyInfo の拡張クラスがあります。
[Table("MyApiKey")]
public class MyApiKey : APIKeyInfo
{
[Key]
public int KeyId { get; set; }
[Required]
public string vCode { get; set; }
}
問題は、これにより EF が APIKeyInfo 内の「リスト文字」プロパティのテーブルを作成しようとすると (MyApiKey テーブルへの FK があると仮定します)、キーが持っているというエラーが表示されることです。定義されていません。ソース コードにアクセスできない場合、"List Characters" プロパティのキーを指定するにはどうすればよいですか? 私は次のようなことを望みます:
[Table("MyApiKey")]
public class MyApiKey : APIKeyInfo
{
[Key]
public int KeyId { get; set; }
[Required]
public string vCode { get; set; }
[Key]
base.Characters.CharacterID;
}
どのプロパティを使用するかを伝えるだけですが、明らかにそれは機能しません。