src/Shared/EntityFramework/Internal/DatabaseCreator.cs
// <summary>
// Creates a database using the core provider (i.e. ObjectContext.CreateDatabase) or
// by using Code First Migrations <see cref="DbMigrator" /> to create an empty database
// and the perform an automatic migration to the current model.
// </summary>
Creates a database using the core provider  or
by using Code First Migrations  to create an empty database
and the perform an automatic migration to the current model.
Creates a database using the core provider or by using Code First Migrations to create an empty database and the perform an automatic migration to the current model .
public virtual void CreateDatabase(
            InternalContext internalContext,
            Func<DbMigrationsConfiguration, DbContext, MigratorBase> createMigrator,
            ObjectContext objectContext)
        {
            DebugCheck.NotNull(internalContext);
            DebugCheck.NotNull(createMigrator);
            if (internalContext.CodeFirstModel != null
                && _resolver.GetService<Func<MigrationSqlGenerator>>(internalContext.ProviderName) != null)
            {
                createMigrator(
                    internalContext.MigrationsConfiguration,
                    internalContext.Owner).Update();
            }
            else
            {
                internalContext.DatabaseOperations.Create(objectContext);
                internalContext.SaveMetadataToDatabase();
            }
            internalContext.MarkDatabaseInitialized();
        }
public virtual void CreateDatabase ( InternalContext internalContext , Func < DbMigrationsConfiguration , DbContext , MigratorBase > createMigrator , ObjectContext objectContext ) { DebugCheck . NotNull ( internalContext ) ; DebugCheck . NotNull ( createMigrator ) ; if ( internalContext . CodeFirstModel != null && _resolver . GetService < Func < MigrationSqlGenerator > > ( internalContext . ProviderName ) != null ) { createMigrator ( internalContext . MigrationsConfiguration , internalContext . Owner ) . Update ( ) ; } else { internalContext . DatabaseOperations . Create ( objectContext ) ; internalContext . SaveMetadataToDatabase ( ) ; } internalContext . MarkDatabaseInitialized ( ) ; }
Creates a database using the core provider (i.e.
Creates a database using the core provider ( i . e .
// objectContext may be null when testing. // If the database is created explicitly, then this is treated as overriding the // database initialization strategy, so make it as already run.
internalContext
InternalContext
createMigrator
Func<DbMigrationsConfiguration, DbContext, MigratorBase>
objectContext
ObjectContext