I have an Entity Framework application that, due to pending changes in the IT policies at the customer's site, we will no longer be able to delete or create databases, but we will be able to drop and create tables within an existing database.
The data for these tables is coming from another source that is not supported by Entity Framework, but does have a minimalist SQL API, so what we have done is create a migration tool that creates the Entity Framework DB on a target server, and then copies the data from the original data source to the server. This migration tool works perfectly, so long as Entity Framework is able to delete and create the database in question. However, if that database is already there, even if it's completely empty, Entity Framework is convinced the DB is fine and doesn't create any tables when it initializes the DbContext. This of course causes the migration tool to fail as soon as it tries to copy the first table.
How do I tell EF to create the tables in the existing database? I have messed around with the various API-provided initializers in System.Data.Entity, but none of them seem to do anything different from the default. Perhaps I am not using them correctly.
p.s. It also wouldn't hurt to know how to tell it to drop those tables, either, although I have already sorted that problem out if there isn't an easy way to do it through the EF API.
The data for these tables is coming from another source that is not supported by Entity Framework, but does have a minimalist SQL API, so what we have done is create a migration tool that creates the Entity Framework DB on a target server, and then copies the data from the original data source to the server. This migration tool works perfectly, so long as Entity Framework is able to delete and create the database in question. However, if that database is already there, even if it's completely empty, Entity Framework is convinced the DB is fine and doesn't create any tables when it initializes the DbContext. This of course causes the migration tool to fail as soon as it tries to copy the first table.
How do I tell EF to create the tables in the existing database? I have messed around with the various API-provided initializers in System.Data.Entity, but none of them seem to do anything different from the default. Perhaps I am not using them correctly.
p.s. It also wouldn't hurt to know how to tell it to drop those tables, either, although I have already sorted that problem out if there isn't an easy way to do it through the EF API.