locked
Entity Framework RRS feed

  • General discussion

  • Hi,

    Please advice me how to add a new column in my project using Entity FrameWork.I am facing error after adding column in model and table .The error has given below

    1)Error 3 Error 3025: Problem in mapping fragments starting at line 677:Must specify mapping for all key properties (tblPatient.pkPatient, tblPatient.IMDL_StatusCode, tblPatient.IMDL_SubTypeCode) of table tblPatient.
    \PMI.ISSN.PMPSA.ServiceMedical.DAL\ServiceMedicalModel.edmx 678 15 PMI.ISSN.PMPSA.ServiceMedical.DAL

    2)Error 4 Error 3025: Problem in mapping fragments starting at line 703:Must specify mapping for all key properties (tblPatient.pkPatient, tblPatient.IMDL_StatusCode, tblPatient.IMDL_SubTypeCode) of table tblPatient.
    \PMI.ISSN.PMPSA.ServiceMedical.DAL\ServiceMedicalModel.edmx 704 11 PMI.ISSN.PMPSA.ServiceMedical.DAL.

    I have attached here Model pattern and error also here.Please

    Please Help me.

    • Moved by Caillen Wednesday, October 22, 2014 7:32 AM
    Tuesday, October 21, 2014 6:32 AM

All replies

  • How are you working with entity framework - code first, database first or model?

    One of your properties isn't mapping to the database correctly - I guess pkPatient.

    Does it match the name exactly of the field in the database?

    Is it

    Entity Key = True

    Nullable = False

    StoreGeneratedPattern = Identity

    The correct type ( Int32  for a sql server int).

    .

    If you're not using code first then:

    Right click on the design surface ( where you see the diagram ).

    Choose "Update Model from database".

    See if that fixes it.

    If it doesn't and you can't see the problem then right click the table and delete it out the model.

    Then repeat the update model from database to add it back.

    Tuesday, October 21, 2014 8:22 AM