コード例 #1
0
 private void RegisterUpgrades(UpgradeTaskCollection config)
 {
     //Make sure the scripts are embedded resources
     if (_connection.BabiesFirstFoodConnection != null)
     {
         //Once and done scripts
         config.Add(new EmbeddedResouceUpgrade(_connection.BabiesFirstFoodConnection, Assembly.GetExecutingAssembly())
         {
             Filter = "BabiesFirstFood.Database.Scripts.Tables"
         });
         //Always run scripts
         config.Add(new EmbeddedResouceUpgrade(_connection.BabiesFirstFoodConnection, Assembly.GetExecutingAssembly())
         {
             Filter  = "BabiesFirstFood.Database.Scripts.Types",
             Journal = new NullJournal() //Adding this allows the script to be rerun
         });
         config.Add(new EmbeddedResouceUpgrade(_connection.BabiesFirstFoodConnection, Assembly.GetExecutingAssembly())
         {
             Filter  = "BabiesFirstFood.Database.Scripts.Views",
             Journal = new NullJournal() //Adding this allows the script to be rerun
         });
         config.Add(new EmbeddedResouceUpgrade(_connection.BabiesFirstFoodConnection, Assembly.GetExecutingAssembly())
         {
             Filter  = "BabiesFirstFood.Database.Scripts.Functions",
             Journal = new NullJournal()
         });
         config.Add(new EmbeddedResouceUpgrade(_connection.BabiesFirstFoodConnection, Assembly.GetExecutingAssembly())
         {
             Filter  = "BabiesFirstFood.Database.Scripts.StoredProcedures",
             Journal = new NullJournal()
         });
     }
 }
コード例 #2
0
        public static bool PerformUpgrade(Action <UpgradeTaskCollection> register)
        {
            var collection = new UpgradeTaskCollection();

            register(collection);

            return(collection.PerformUpgrade());
        }