Deleted table

2 posts, 0 answers
  1. Fabio Perrone
    Fabio Perrone avatar
    3 posts
    Member since:
    Sep 2009

    Posted 23 Nov 2012 Link to this post

    Hello, which is the best way to manage a delete in the database since it's not managed automatically as stated in the documentation (How to Update a Model from an Existing Database) ? If I try to manually remove the entity by the Model Schema Explorer, I always receive the warning: the 'MyTableName' table is not mapped to a persistent capable class.


    Thanks in advance


    Fabio
  2. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 26 Nov 2012 Link to this post

    Hi Fabio,

    Indeed, the Update From Database wizard of Telerik OpenAccess ORM does not detect the removal of a database table as a change in the model. The assumptions here are:
    - Your model may include domain classes that are not persisted in the database yet
    - Your model may not include all the tables present in the database
    - The class might be important for your data layer and by removing it we can make your code not buildable

    For those reasons, you can remove a table from both the database and the model only manually. The steps are as follows:
    1) Delete the table from the database
    2) In Visual Designer, delete the domain class corresponding to the deleted table
    3) Delete the table from Model Schema Explorer as well

    Note also, that if you delete a table from the model, the Update Database from Model wizard will not recognize that as a change in the database.

    I hope that helps. If you have any additional questions, do not hesitate to get back to us.
     
    Regards,
    Doroteya
    the Telerik team
    Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
  3. DevCraft banner
Back to Top