none
Error with DbContext RRS feed

  • Question

  • I am getting this error while using Entity framework and repository pattern. i.e when I call a repository instance.GetAll method

    The entity type Postalcode is not part of the model for the current context.

    Thursday, February 23, 2012 4:37 PM

Answers

  • Hi Irfan Hyderabad,

    Welcome to MSDN Forum.

    There are two possible reasons which can lead this error.

    1. The connection string is wrong, so the entity doesn't map to the database.

    2. The configuration of the DBContext isn't map the entity to the database.

    Please double check the two possible cause.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Monday, February 27, 2012 2:46 AM
    Moderator

All replies

  • Hi Irfan Hyderabad,

    Welcome to MSDN Forum.

    There are two possible reasons which can lead this error.

    1. The connection string is wrong, so the entity doesn't map to the database.

    2. The configuration of the DBContext isn't map the entity to the database.

    Please double check the two possible cause.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Monday, February 27, 2012 2:46 AM
    Moderator
  • The entity wasnt mapped properly to the db context. Actually my architect was using an .edmx where the table was nt added. Thanks, now it is working.
    Monday, February 27, 2012 9:27 AM