IF adding new Entity gives error me : EntityCommandCompilationException was unhandled bu user code

Posted by programmerist on Stack Overflow See other posts from Stack Overflow or by programmerist
Published on 2010-04-05T10:22:54Z Indexed on 2010/04/05 10:33 UTC
Read the original article Hit count: 915

i have 5 tables in started projects. if i adds new table (Urun enttiy) 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\ModelSatis.edmx 749 15 GenoTip.DAL

© Stack Overflow or respective owner

Related posts about c#3.0

Related posts about ASP.NET