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


C# Configuration.GenerateDropSchemaScript方法代码示例

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


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

示例1: SchemaExport

 /// <summary>
 /// Create a schema exporter for the given Configuration, with the given
 /// database connection properties
 /// </summary>
 /// <param name="cfg">The NHibernate Configuration to generate the schema from.</param>
 /// <param name="connectionProperties">The Properties to use when connecting to the Database.</param>
 public SchemaExport(Configuration cfg, IDictionary<string, string> connectionProperties)
 {
     this.connectionProperties = connectionProperties;
     dialect = Dialect.Dialect.GetDialect(connectionProperties);
     dropSQL = cfg.GenerateDropSchemaScript(dialect);
     createSQL = cfg.GenerateSchemaCreationScript(dialect);
 }
开发者ID:pallmall,项目名称:WCell,代码行数:13,代码来源:SchemaExport.cs

示例2: SchemaExport

		/// <summary>
		/// Create a schema exporter for the given Configuration, with the given
		/// database connection properties
		/// </summary>
		/// <param name="cfg">The NHibernate Configuration to generate the schema from.</param>
		/// <param name="configProperties">The Properties to use when connecting to the Database.</param>
		public SchemaExport(Configuration cfg, IDictionary<string, string> configProperties)
		{
			this.configProperties = configProperties;
			dialect = Dialect.Dialect.GetDialect(configProperties);
			dropSQL = cfg.GenerateDropSchemaScript(dialect);
			createSQL = cfg.GenerateSchemaCreationScript(dialect);
			formatter = (PropertiesHelper.GetBoolean(Environment.FormatSql, configProperties, true) ? FormatStyle.Ddl : FormatStyle.None).Formatter;
		}
开发者ID:pruiz,项目名称:nhibernate-old,代码行数:14,代码来源:SchemaExport.cs

示例3: BuildSchema

        public void BuildSchema(ISession session, Configuration configuration)
        {
            IDbConnection connection = session.Connection;

            Dialect dialect = Dialect.GetDialect(configuration.Properties);
            string[] drops = configuration.GenerateDropSchemaScript(dialect);
            ExecuteScripts(drops, connection);

            string[] scripts = configuration.GenerateSchemaCreationScript(dialect);
            ExecuteScripts(scripts, connection);
        }
开发者ID:calebjenkins,项目名称:presentations,代码行数:11,代码来源:ConfigurationFactory.cs

示例4: LiveSqliteSchema

 static LiveSqliteSchema()
 {
     var config = new Configuration();
     config.SetProperty(Environment.Dialect, "NHibernate.Dialect.SQLiteDialect");
     config.AddInputStream(HbmSerializer.Default.Serialize(Assembly.Load("tanzer.lotto.core")));
     Dialect dialect = Dialect.GetDialect(config.Properties);
     // pause at critical moments; row COUNT; rollback journal; isolation level
     // @sa http://www.sqlite.org/pragma.html
     script = "PRAGMA synchronous=FALSE;PRAGMA count_changes=FALSE;PRAGMA journal_mode=FALSE;PRAGMA read_uncommitted=TRUE;";
     script += String.Join(";", config.GenerateDropSchemaScript(dialect));
     script += ";";
     script += String.Join(";", config.GenerateSchemaCreationScript(dialect));
     script += ";";
 }
开发者ID:bjornebjornson,项目名称:LottoNh2,代码行数:14,代码来源:LiveSqliteSchema.cs

示例5: Main

        static int Main(string[] args)
        {
            try
            {
                log4net.Config.XmlConfigurator.Configure();
                string scriptDir = Settings.Default.ScriptsDir;
                if (!Path.IsPathRooted (scriptDir))
                {
                    scriptDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, scriptDir);
                }

                Console.WriteLine("Generating script...");

                Configuration cfg = new Configuration();
                cfg.Configure();

                Dialect dialect = Dialect.GetDialect(cfg.Properties);
                string[] dropStatements = cfg.GenerateDropSchemaScript(dialect);
                string[] createStatements = cfg.GenerateSchemaCreationScript(dialect);

                using (StreamWriter writer = new StreamWriter(Path.Combine(scriptDir, Settings.Default.ScriptToGenerate), false, Encoding.Default))
                {
                    foreach (string s in dropStatements)
                    {
                        string f = Format(ParseDropConstraint(s));
                        writer.WriteLine(f);
                    }

                    writer.WriteLine();

                    foreach (string s in createStatements)
                    {
                        string f = Format(ParseCreateTable(s));
                        writer.WriteLine(f);
                    }

                    foreach (string scriptToAppend in Settings.Default.ScriptsToAppend)
                    {
                        writer.WriteLine();
                        writer.WriteLine(File.ReadAllText(Path.Combine(scriptDir, scriptToAppend),Encoding.Default));
                    }
                }
                Console.WriteLine("Done");
            }
            catch (Exception e)
            {
                log.Error(e);
                Console.WriteLine(e);
                return 1;
            }

            return 0;
        }
开发者ID:andreyu,项目名称:Reports,代码行数:53,代码来源:Program.cs

示例6: ExportDropeSchema

 public static string[] ExportDropeSchema(Dialect dialect)
 {
     Configuration cfg = new Configuration();
     cfg.Configure();
     return cfg.GenerateDropSchemaScript(dialect);
 }
开发者ID:Ravivishnubhotla,项目名称:basewebframework,代码行数:6,代码来源:SchemaHelper.cs


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