エンティティにナビゲーション プロパティを実装する方法を理解しようとしていますが、ナビゲーション プロパティは常に null です。
2 つのエンティティを設定しました。
エンティティ 1 には次の行が含まれます。
public int Id { get; set; }
public ICollection<BestellterArtikel> BestellteArtikel { get; set; }
私の 2 番目のエンティティは次のようになります。
public int Id { get; set; }
public int BestellungId { get; set; }
public Bestellung BestellteArtikel { get; set; }
さらに、上書きした OnModelCreating-Method に次の行を含めました。
modelBuilder.Entity<Bestellung>().HasMany(e => e.BestellteArtikel).WithRequired(e => e.Bestellung);
私は何を間違えましたか?私は何か重要なことを忘れていますか?そして、それはそれほど複雑でなければなりませんか?プロパティごとに上書きされたメソッドに行を追加する必要がありますか?