Re-Add deleted entity

3 posts, 0 answers
  1. S
    S avatar
    10 posts
    Member since:
    Nov 2013

    Posted 23 Mar 2015 Link to this post

    I deleted an entity and intend to add it back. Unfortunately, I couldn't get it back by trying from "Update From Database".

    When I made changes to the actual table, I can trigger see the table. After the update, I can't find the entity. My code now complaints for the non-existence of the entity.

    Please help 
  2. S
    S avatar
    10 posts
    Member since:
    Nov 2013

    Posted 24 Mar 2015 in reply to S Link to this post

    Is good now. I got it solved
  3. DevCraft banner
  4. Yavor Slavchev
    Admin
    Yavor Slavchev avatar
    22 posts

    Posted 26 Mar 2015 Link to this post

    Hi,
    I'm glad to hear from you that the issue you were facing is now resolved.

    However, I want to clarify this behavior to let you understand how database mapping works more clearly.
    When you delete an entity from the designer, it is actually deleted only as a type and not as an relation item from the model schema.The Model schema is used as a starting point when updating the model form the database, i.e. when the model is updated from database, it compares database objects (tables, views, etc) with the items from the model schema.
    In your case, when you deleted the entity from the designer, you actually delete it only from the domain model and the table in the model schema explorer still exists. When you delete the table from Model Schema Explorer, then the next time you execute "Update From Database" the missing entity will be tracked as new and will be added to the designer.
    You can take a look at this article for more information how to track database changes and how to delete entities.

    I hope this information is helpful.

    Regards,
    Yavor Slavchev
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
Back to Top