开发者

Adding new entity gives error: EntityCommandCompilationException was unhandled bu user code in Entity Framework

开发者 https://www.devze.com 2022-12-25 10:50 出处:网络
I have 5 tables in started projects. If I adds new table (Urun entity) writing below codes: project.BAL :

I have 5 tables in started projects. If I adds new table (Urun entity) writing below codes:

project.BAL :

public static List<Urun> GetUrun()
{
   using (GenoTipSatisEntities genSatisUrunCtx = new GenoTipSatisEntities())
   {
      ObjectQuery<Urun> urun = genSatisUrunCtx.Urun;
      return urun.ToList();
   }
}

if I receive data form BAL in UI.aspx:

using project.BAL;


namespace GenoTip.Web.ContentPages.Satis
{
    public partial class SatisUrun : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FillUrun();
            }
        }

        void FillUrun()
        {
            ddlUrun.DataSource = SatisServices.GetUrun();
            ddlUrun.DataValueField = "ID";
            ddlUrun.DataTextField = "Ad";
            ddlUrun.DataBind();
        }
    }
}

I added URun later. error appears ToList method: EntityCommandCompilationException was unhandled bu user code

error Detail:

Error 1 Error 3007: Problem in Mapping Fragments starting at lines 659, 873: Non-Primary-Key column(s) [UrunID] are being mapped in both fragments to different conceptual side properties - data inconsistency is possible because the corresponding conceptual side properties can be independently modified. C:\Users\pc\Desktop\GenoTip.Satis\GenoTip.DAL\ModelSatis.edmx 660 15 GenoTip.DAL

Error 2 Error 3012: Problem in Mapping Fragments starting at lines 659, 873: Data loss is possible in FaturaDetay.UrunID.

An Entity with Key (PK) will not round-trip when:

(PK does NOT play Role 'FaturaDetay' in AssociationSet 'FK_FaturaDetay_Urun' AND PK is in 'FaturaDetay' EntitySet)

C:\Users\pc\Desktop\GenoTip.Satis\GenoTip.DAL\ModelSatis.edmx 874 11 GenoTip.DAL

Error 3 Error 3012: Problem in Mapping Fragments starting at lines 659, 873: Data loss is possible in FaturaDetay.UrunID.

An Entity with Key (PK) will not round-trip when:

(PK is in 'FaturaDetay' EntitySet AND PK does NOT play Role 'FaturaDetay' in AssociationSet 'FK_FaturaDetay_Urun' AND Entity.UrunID is not NULL)

C:\Users\pc\Desktop\GenoTip.Satis\GenoTip.DAL\ModelSatis.edmx 660 15 GenoTip.DAL

Error 4 Error 3007: Problem in Mapping Fragments starting at lines 748, 879: Non-Primary-Key column(s) [UrunID] are being mapped in both fragments to different conceptual side properties - data inconsistency is possible because the corresponding conceptual side properties can be independently modified. C:\Users\pc\Desktop\GenoTip.Satis\GenoTip.DAL\ModelSatis.edmx 749 15 GenoTip.DAL

Error 5 Error 3012: Problem in Mapping Fragments starting at lines 748, 879: Data loss is possible in Satis.UrunID.

An Entity with Key (PK) will not round-trip when:

(PK does NOT play Role 'Satis' in AssociationSet 'FK_Satis_Urun' AND PK is in 'Satis' EntitySet)

C:\Users\pc\Desktop\GenoTip.Satis\GenoTip.DAL\ModelSatis.edmx 880 11 GenoTip.DAL

Error 6 Error 3012: Problem in Mapping Fragments starting at lines 748, 879: Data loss is possible in Satis.UrunID.

An Entity with Key (PK) will not round-trip when:

(PK is in 'Satis' EntitySet AND PK does NOT play Role 'Satis' in AssociationSet 'FK_Satis_Urun' AND Entity.UrunID is not NULL)

C:\Users\pc\Desktop\GenoTip.Satis\GenoTip.DAL\ModelSati开发者_如何学Pythons.edmx 749 15 GenoTip.DAL

0

精彩评论

暂无评论...
验证码 换一张
取 消