none
DbContext.Entry Error - Could not find the conceptual model type for RRS feed

  • Question

  • I am getting a strange error when performing the following.

    I have database called Persons that is accessed via entity framework.

    I create instance of Persons called newPerson and add it to the object context. Of course the entity state will be EntityState.Added.

    Next, I create an instance of the DbContext passing in the objectcontext.

    Finnally, I used the following syntax

    dbContext.Entry(newPerson)

    to access the DbContext property features.

    Immediately I get and error saying

    Could not find the conceptual model type for tblComparisions.

    I don't even have a table tblComparisions.

    Any suggestions?



    • Edited by CoreyGlory Friday, March 15, 2013 2:34 PM
    Friday, March 15, 2013 1:59 AM

Answers

  • This issue was a little confusing, but it is now fixed.

    I was trying to create a DbEntry using a object whose EntityState was Detached.

    I had to add the object to the context and everything worked fine.

    • Marked as answer by CoreyGlory Friday, March 15, 2013 4:05 PM
    Friday, March 15, 2013 4:05 PM

All replies

  • This issue was a little confusing, but it is now fixed.

    I was trying to create a DbEntry using a object whose EntityState was Detached.

    I had to add the object to the context and everything worked fine.

    • Marked as answer by CoreyGlory Friday, March 15, 2013 4:05 PM
    Friday, March 15, 2013 4:05 PM
  • Hi CoreyGlory,

    Welcome to the MSDN forum.

    Glad to know your problem is solved. Thank you for sharing.

    Good day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 18, 2013 2:36 AM