Ejemplo n.º 1
0
        public DbMigrator CreateMigrator <TContext>(DbMigration migration)
            where TContext : DbContext
        {
            var modelCompressor = new ModelCompressor();

            var generatedMigration
                = CodeGenerator
                  .Generate(
                      UtcNowGenerator.UtcNowAsMigrationIdTimestamp() + "_" + migration.GetType().Name,
                      migration.GetOperations(),
                      Convert.ToBase64String(modelCompressor.Compress(CreateContext <TContext>().GetModel())),
                      Convert.ToBase64String(modelCompressor.Compress(CreateContext <TContext>().GetModel())),
                      "System.Data.Entity.Migrations",
                      migration.GetType().Name);

            return(new DbMigrator(CreateMigrationsConfiguration <TContext>(scaffoldedMigrations: generatedMigration)));
        }
Ejemplo n.º 2
0
        public static string CreateMigrationId(string migrationName)
        {
            DebugCheck.NotEmpty(migrationName);

            return(UtcNowGenerator.UtcNowAsMigrationIdTimestamp() + "_" + migrationName);
        }
Ejemplo n.º 3
0
 public static string CreateMigrationId(string migrationName)
 {
     return(UtcNowGenerator.UtcNowAsMigrationIdTimestamp() + "_" + migrationName);
 }