当前位置: 首页>>代码示例>>C#>>正文


C# SchemaExport.SetOutputFile方法代码示例

本文整理汇总了C#中NHibernate.Tool.hbm2ddl.SchemaExport.SetOutputFile方法的典型用法代码示例。如果您正苦于以下问题:C# SchemaExport.SetOutputFile方法的具体用法?C# SchemaExport.SetOutputFile怎么用?C# SchemaExport.SetOutputFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NHibernate.Tool.hbm2ddl.SchemaExport的用法示例。


在下文中一共展示了SchemaExport.SetOutputFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NHibernateManager

        /// <summary>
        /// Initiate NHibernate Manager
        /// </summary>
        /// <param name="connect">NHibernate dialect, driver and connection string separated by ';'</param>
        /// <param name="store">Name of the store</param>
        public NHibernateManager(string connect, string store)
        {
            try
            {
                ParseConnectionString(connect);

                //To create sql file uncomment code below and write the name of the file
                SchemaExport exp = new SchemaExport(configuration);
                exp.SetOutputFile("db_creation.sql");
                exp.Create(false, true);

                sessionFactory = configuration.BuildSessionFactory();

            }
            catch (MappingException mapE)
            {
                if (mapE.InnerException != null)
                    Console.WriteLine("[NHIBERNATE]: Mapping not valid: {0}, {1}, {2}", mapE.Message, mapE.StackTrace, mapE.InnerException.ToString());
                else
                    m_log.ErrorFormat("[NHIBERNATE]: Mapping not valid: {0}, {1}", mapE.Message, mapE.StackTrace);
            }
            catch (HibernateException hibE)
            {
                Console.WriteLine("[NHIBERNATE]: HibernateException: {0}, {1}", hibE.Message, hibE.StackTrace);
            }
            catch (TypeInitializationException tiE)
            {
                Console.WriteLine("[NHIBERNATE]: TypeInitializationException: {0}, {1}", tiE.Message, tiE.StackTrace);
            }
        }
开发者ID:jonnenauha,项目名称:ModreX,代码行数:35,代码来源:NHibernateManager.cs

示例2: CreateSchemaExport

 private SchemaExport CreateSchemaExport(Configuration config)
 {
     var result = new SchemaExport(config);
     if (!string.IsNullOrEmpty(this.delimiter)) result.SetDelimiter(this.delimiter);
     if (!string.IsNullOrEmpty(this.outputFile)) result.SetOutputFile(this.outputFile);
     return result;
 }
开发者ID:night-king,项目名称:NHibernate-Shards,代码行数:7,代码来源:ShardedSchemaExport.cs

示例3: ChangeRawConfig

        /// <summary>Changes the raw NHibernate config.</summary>
        /// <param name="config">The configuration to change.</param>
        public void ChangeRawConfig(Configuration config)
        {
            var schemaExport = new SchemaExport(config);
            var path = string.Empty;
            if (_outputSql)
            {
                path = Path.Combine(Path.GetTempPath(), "NHibernate SQL");
                Directory.CreateDirectory(path);
                schemaExport.SetOutputFile(Path.Combine(path, "drop.sql"));
            }

            schemaExport.Drop(false, true);
            if (_outputSql)
                schemaExport.SetOutputFile(Path.Combine(path, "create.sql"));
            schemaExport.Create(false, true);
        }
开发者ID:dhilgarth,项目名称:fd.Base,代码行数:18,代码来源:SchemaRecreator.cs

示例4: CreateSchema

 static void CreateSchema()
 {
     SchemaExport export = new SchemaExport(m_NHConfiguration);
     export.SetDelimiter(";");
     export.SetOutputFile(@"db.sql").Execute(false, false, false);
     Console.WriteLine("Schema Exported");
 }
开发者ID:JoeBuntu,项目名称:Inventory,代码行数:7,代码来源:Program.cs

示例5: btnGenerateDBScript_Click

        private void btnGenerateDBScript_Click(object sender, RoutedEventArgs e)
        {
            Assembly assembly = Assembly.LoadFrom(txtFileName.Text);

            IPersistenceConfigurer databaseConfig = null;
            string fileName = "Domain Database Script - {0}.sql";

            if (rdbSqlServer.IsChecked != null)
                if (rdbSqlServer.IsChecked.Value)
                {
                    databaseConfig = MsSqlConfiguration.MsSql2005;
                    fileName = string.Format(fileName, "Sql Server 2005");
                }
                else if (rdbOracle.IsChecked != null)
                    if (rdbOracle.IsChecked.Value)
                    {
                        databaseConfig = OracleDataClientConfiguration.Oracle9;
                        fileName = string.Format(fileName, "Oracle 9g");
                    }

            Fluently.Configure()
                .Mappings(m => m.FluentMappings.AddFromAssembly(assembly))
                .Database(databaseConfig)//.ConnectionString("Data Source=.\\SQLEXPRESS;Initial Catalog=master;Integrated Security=True"))
                .ExposeConfiguration(config =>
                {
                    SchemaExport se = new SchemaExport(config);
                    se.SetOutputFile(fileName);
                    se.Create(false, false);
                    MessageBox.Show(string.Format("Script successful created! See the '{0}' file.", fileName));
                }).BuildConfiguration();
        }
开发者ID:tiagomaximo,项目名称:LiteFx,代码行数:31,代码来源:MainWindow.xaml.cs

示例6: CreateDatabase

 /// <summary>
 /// Generate the database schema, apply it to the database and save the DDL used into a file.
 /// </summary>
 public static void CreateDatabase()
 {
     Configuration configuration = new Configuration();
     configuration.Configure();
     SchemaExport schemaExport = new SchemaExport(configuration);
     schemaExport.SetOutputFile("SQLite database schema.ddl");
     schemaExport.Create(true, true);
 }
开发者ID:rafidzal,项目名称:Sif3Framework-dotNet,代码行数:11,代码来源:DataFactory.cs

示例7: CreateSchema

 public void CreateSchema()
 {
     var nhConfig = new ConfigurationBuilder().Build();
     var schemaExport = new SchemaExport(nhConfig);
     schemaExport
         .SetOutputFile(@"db.sql")
         .Execute(false, false, false);
 }
开发者ID:fr4nky80,项目名称:LearnCSharp,代码行数:8,代码来源:CatsBP.cs

示例8: createDatabase

 public static void createDatabase()
 {
     var nhconfig = new Configuration().Configure();
     var sessionFactory = nhconfig.BuildSessionFactory();
     var schemaExport = new SchemaExport(nhconfig);
     schemaExport.SetOutputFile(@"concepts.sql")
         .Execute(true, true, false);
     Console.WriteLine("I created your database");
 }
开发者ID:Itslet,项目名称:Concepts,代码行数:9,代码来源:Program.cs

示例9: TestGenerationOfSchema

 public void TestGenerationOfSchema()
 {
     Configuration configuration = new Configuration();
     configuration.Configure();
     configuration.AddAssembly(typeof(State).Assembly);
     SchemaExport schemaExport = new SchemaExport(configuration);
     schemaExport.SetOutputFile("schema.sql");
     schemaExport.Execute(false, true, false);
 }
开发者ID:karldickman,项目名称:XCAnalyze,代码行数:9,代码来源:TestGenerateSchema.cs

示例10: Create_Database

        public void Create_Database()
        {
            Configuration config = sessionBuilder.GetConfiguration();

            var exporter = new SchemaExport(config);

            exporter.SetOutputFile(@"C:\temp\GroopSchema.ddl");
            exporter.Create(true, false);
        }
开发者ID:TimBarcz,项目名称:groop,代码行数:9,代码来源:SchemaGeneration.cs

示例11: DropAndRecreateSchema

        private void DropAndRecreateSchema()
        {
            SchemaExport schemaExport = new SchemaExport(this.configuration);

            schemaExport.SetOutputFile(@"..\..\nhibernate-schema.txt");

            schemaExport.Drop(script: false, export: true);
            schemaExport.Create(script: false, export: true);
        }
开发者ID:hermanpotgieter,项目名称:Code.Pizza,代码行数:9,代码来源:TestBase.cs

示例12: CreatSchema

 public static void CreatSchema(string OutputFile, string ConnString)
 {
     FNHMVC.Data.Infrastructure.ConnectionHelper.GetConfiguration(ConnString).ExposeConfiguration(cfg =>
     {
         var schemaExport = new NHibernate.Tool.hbm2ddl.SchemaExport(cfg);
         if (!string.IsNullOrEmpty(OutputFile)) schemaExport.SetOutputFile(OutputFile);
         schemaExport.Drop(false, true);
         schemaExport.Create(false, true);
     }).BuildConfiguration();
 }
开发者ID:kostyrin,项目名称:FNHMVC,代码行数:10,代码来源:SchemaTool.cs

示例13: Generate

 public void Generate()
 {
     var databaseSchemaFileName = GetDatabaseSchemaFileName();
     File.Delete(databaseSchemaFileName);
     var nHibernateConfigurator = GetNhibernateConfigurator();
     var schemaExport = new SchemaExport(nHibernateConfigurator.GetConfiguration());
     schemaExport.SetOutputFile(databaseSchemaFileName);
     schemaExport.Create(true, false);
     if (!File.Exists(databaseSchemaFileName) || new FileInfo(databaseSchemaFileName).Length == 0) throw new Exception("Error generating database schema");
 }
开发者ID:xhafan,项目名称:emailmaker,代码行数:10,代码来源:DatabaseSchemaGenerator.cs

示例14: Should_save_schema_to_file

        public void Should_save_schema_to_file()
        {
            var cfg = new Configuration();
            cfg.Configure();
            cfg.AddAssembly(typeof(Product).Assembly);

            var schemaExport = new SchemaExport(cfg);
            schemaExport.SetOutputFile("../../GeneratedSchema/schema.sql");
            schemaExport.Create(true, true);
        }
开发者ID:dineshkummarc,项目名称:SqliteSpike,代码行数:10,代码来源:When_generating_schema.cs

示例15: Main

        static void Main(string[] args)
        {
            var nhConfig = new Configuration().Configure();
              var sessionFactory = nhConfig.BuildSessionFactory();

              var schemaExport = new SchemaExport(nhConfig);
              schemaExport
            .SetOutputFile(@"db.sql")
            .Execute(false, false, false);
        }
开发者ID:akhuang,项目名称:NHibernate,代码行数:10,代码来源:Program.cs


注:本文中的NHibernate.Tool.hbm2ddl.SchemaExport.SetOutputFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。