This is a migrated thread and some comments may be shown as answers.

Deleted table

1 Answer 102 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Fabio Perrone
Top achievements
Rank 1
Fabio Perrone asked on 23 Nov 2012, 05:38 PM
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

1 Answer, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 26 Nov 2012, 09:29 AM
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.
Tags
Data Access Free Edition
Asked by
Fabio Perrone
Top achievements
Rank 1
Answers by
Doroteya
Telerik team
Share this question
or