Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: Code First Logic to create tables on empty database should work with other providers [371]

$
0
0
**EF Team Triage: We should do this as part of the provider improvement planned after EF6** http://entityframework.codeplex.com/workitem/415

In EF5 we made Code First work in scenarios in which the target database exists but the tables still need to be created. This functionality depends on a check that is implemented in the method DatabaseTableChecker.AnyModelTableExists which currently executes hardcoded SQL information schema queries for "System.Data.SqlClient" and "System.Data.SqlClientCe.4.0" but returns true for any other ADO.NET provider invariant names:

switch (providerName)
{
case "System.Data.SqlClient":
provider = new SqlPseudoProvider();
break;
case "System.Data.SqlServerCe.4.0":
provider = new SqlCePseudoProvider();
break;
default:
return true;
}

We should instead make this logic work with any provider either moving the capabilities of the pseudo provider into the actual provider model or by taking advantage of existing functionality of the Migrations Initializer or of schema discovery in the existing provider model.
Comments: We could also include a default implementation of DatabaseTableChecker that is based on the schema views. This implementation would be slower than a specialized one and could potentially not provider correct if the database backend doesn't handle schema as part of the table name (e.g. like SQL CE), but it should work for most providers.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>