Exemplo n.º 1
0
        public void UpdateDatabase()
        {
            var configuration = new DataMigrations();

            configuration.TargetDatabase = new DbConnectionInfo(
                "DataContext");

            //	"Server=.\\SQLEXPRESS;Database=CriminalProcedure;Trusted_Connection=True;",
            //"System.Data.SqlClient");
            var migrator = new DbMigrator(configuration);

            migrator.Update();
        }
Exemplo n.º 2
0
        public void AddMigrations(int i)
        {
            var config     = new DataMigrations();
            var scaffolder = new MigrationScaffolder(config);
            var migration  = scaffolder.Scaffold("Migration" + i);

            File.WriteAllText("Migrations/" + migration.MigrationId + ".cs", migration.UserCode);

            File.WriteAllText("Migrations/" + migration.MigrationId + ".Designer.cs", migration.DesignerCode);

            using (var writer = new ResXResourceWriter("Migrations/" + migration.MigrationId + ".resx"))
            {
                foreach (var resource in migration.Resources)
                {
                    writer.AddResource(resource.Key, resource.Value);
                }
            }
        }