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


C# DdlGeneratorFactory.WriteToScript方法代码示例

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


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

示例1: RunSprocs

        public bool RunSprocs(DirectoryInfo directory, SqlType dialect, DatabaseTable table)
        {
            if (table == null)
            {
                Message = "No table";
                return false;
            }

            var gen = new DdlGeneratorFactory(dialect).ProcedureGenerator(table);
            if (gen == null)
            {
                //there is no sproc provider (SQLite)
                Message = @"There is no sproc generator";
                return false;
            }
            var path = Path.Combine(directory.FullName, table.Name + "_sprocs.sql");
            try
            {
                gen.WriteToScript(path);
                Message = @"Wrote " + path;
                return true;
            }
            catch (Exception exception)
            {
                Message =
                    @"An error occurred while creating the script.\n" + exception.Message;
            }
            return false;
        }
开发者ID:Petran15,项目名称:dbschemareader,代码行数:29,代码来源:TaskRunner.cs

示例2: TestWritingCrudSprocs

        public void TestWritingCrudSprocs()
        {
            var table = LoadCategoriesFromNorthwind();

            //let's create the SQLServer crud procedures
            var gen = new DdlGeneratorFactory(SqlType.SqlServer).ProcedureGenerator(table);
            gen.ManualPrefix = table.Name + "__";
            var destination = TestHelper.CreateDirectory("sql").FullName;
            var path = Path.Combine(destination, "sqlserver_sprocs.sql");
            gen.WriteToScript(path);

            var txt = File.ReadAllText(path);
            Assert.IsFalse(string.IsNullOrEmpty(txt), "Should have written some text");
            //manually check the script is ok
        }
开发者ID:shiningrise,项目名称:dbschemareader,代码行数:15,代码来源:WritingSprocsTest.cs

示例3: TestWritingCrudSprocsWithOracleConversion

        public void TestWritingCrudSprocsWithOracleConversion()
        {
            var table = LoadCategoriesFromNorthwind();

            //let's pretend it's an oracle table and create an oracle package
            var oracleGen = new DdlGeneratorFactory(SqlType.Oracle).ProcedureGenerator(table);
            oracleGen.ManualPrefix = table.Name + "__";
            //here i want all my parameters prefixed by a p
            oracleGen.FormatParameter = name => "p_" + name;
            //also define the cursor parameter
            oracleGen.CursorParameterName = "p_cursor";
            var destination = TestHelper.CreateDirectory("sql").FullName;
            var oraclePath = Path.Combine(destination, "oracle_sprocs.sql");
            oracleGen.WriteToScript(oraclePath);

            var txt = File.ReadAllText(oraclePath);
            Assert.IsFalse(string.IsNullOrEmpty(txt), "Should have written some text");
            //manually check the script is ok
        }
开发者ID:shiningrise,项目名称:dbschemareader,代码行数:19,代码来源:WritingSprocsTest.cs


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