示例#1
0
        public void IsDbInActualState()
        {
            Configuration configuration = new MsSql2008Initializer().GetConfiguration();

            var factory = (ISessionFactoryImplementor)configuration.BuildSessionFactory();

            using (ISession session = factory.OpenSession())
            {
                string[] updateScripts = configuration.GenerateSchemaUpdateScript(factory.Dialect, new DatabaseMetadata((DbConnection)session.Connection, factory.Dialect));
                Assert.AreEqual(string.Empty, updateScripts);
            }
        }
示例#2
0
        public void GenerateMigrationScript()
        {
            Configuration configuration = new MsSql2008Initializer().GetConfiguration();
            var           factory       = (ISessionFactoryImplementor)configuration.BuildSessionFactory();

            using (ISession session = factory.OpenSession())
            {
                string[] updateScripts = configuration.GenerateSchemaUpdateScript(factory.Dialect, new DatabaseMetadata((DbConnection)session.Connection, factory.Dialect));

                foreach (string updateScript in updateScripts)
                {
                    Console.WriteLine(updateScript);
                    Console.WriteLine("GO");
                }
            }
        }