このエラーが発生しました。私はこのエラーをtitleと言っています。私はGoogleを検索して答えを見つけることができません。それは大丈夫です、そして、私が追加するためにefを使用するとき、それはwork.looksを下に見ることができません、それは私のデータベーススキーマです。結果としてEF:ReferentialConstraintの依存プロパティーがストア生成列にマップされています。
using ppdai.user.vip.model;
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.ModelConfiguration.Configuration;
namespace ppdai.user.vip.model.mapping
{
public class GoodsMapping: EntityTypeConfiguration<Goods>
{
public GoodsMapping()
{
this.Property(x => x.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
this.HasKey(x => x.Id);
this.Property(x => x.GoodsQuantity).IsRequired();
this.Property(x => x.GoodPrice).IsRequired();
this.Property(x => x.GoodScore).IsRequired();
this.Property(x => x.GoodTypeId).IsRequired();
this.HasRequired(x => x.GoodType)
.WithMany(x => x.Goods)
.HasForeignKey(x => x.GoodTypeId);
}
}
}
、良いは「中央」テーブルの位置を次のとおりです。私は良いテーブルに何かを追加しようとすると、エラーが良いの流暢APIをoccured.the
は次のようにいるようです私のデータベースでは、誰もそれを解決する方法を知っていますか?
あなたはforegin keyを '.HasForeignKey(x => x.GoodTypeId);によって定義しました。 –
@AliSoltani私は外来キーを盗んでもまだ動作しないので、 – MapleStory