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


C# DdlGeneratorFactory.Write方法代码示例

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


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

示例1: TestWritingNorthwindTables

        public void TestWritingNorthwindTables()
        {
            var schemas = LoadCategoriesFromNorthwind().DatabaseSchema;

            //take a SQLServer Northwind and write all the tables and relations
            var gen = new DdlGeneratorFactory(SqlType.SqlServer).AllTablesGenerator(schemas);
            var txt = gen.Write();

            Assert.IsFalse(string.IsNullOrEmpty(txt), "Should have written some text");

            //let's translate it into Oracle.
            var oracleGen = new DdlGeneratorFactory(SqlType.Oracle).AllTablesGenerator(schemas);
            oracleGen.IncludeSchema = false; //we don't want "dbo." prefixes
            txt = oracleGen.Write();
            Assert.IsFalse(string.IsNullOrEmpty(txt), "Should have written some text");

            //let's translate it into MySQL.
            var mysqlGen = new DdlGeneratorFactory(SqlType.MySql).AllTablesGenerator(schemas);
            mysqlGen.IncludeSchema = false; //we don't want "dbo." prefixes
            var mySqlTxt = mysqlGen.Write();
            Assert.IsFalse(string.IsNullOrEmpty(mySqlTxt), "Should have written some text");

            //let's translate it into SQLite.
            var sqliteGen = new DdlGeneratorFactory(SqlType.SQLite).AllTablesGenerator(schemas);
            sqliteGen.IncludeSchema = false; //we don't want "dbo." prefixes
            var sqliteTxt = sqliteGen.Write();
            Assert.IsFalse(string.IsNullOrEmpty(sqliteTxt), "Should have written some text");

            //manually check the script is ok
        }
开发者ID:shiningrise,项目名称:dbschemareader,代码行数:30,代码来源:WritingSprocsTest.cs

示例2: RunTableDdl

 public bool RunTableDdl(DirectoryInfo directory, SqlType dialect)
 {
     var tg = new DdlGeneratorFactory(dialect).AllTablesGenerator(_databaseSchema);
     tg.IncludeSchema = false;
     string txt;
     try
     {
         txt = tg.Write();
     }
     catch (Exception exception)
     {
         Message =
             @"An error occurred while creating the script.\n" + exception.Message;
         return false;
     }
     try
     {
         var path = Path.Combine(directory.FullName, "table.sql");
         File.WriteAllText(path, txt);
         Message = @"Wrote " + path;
         return true;
     }
     catch (Exception exception)
     {
         Message =
             @"An IO error occurred while writing the file.\n" + exception.Message;
     }
     return false;
 }
开发者ID:Petran15,项目名称:dbschemareader,代码行数:29,代码来源:TaskRunner.cs

示例3: TestWritingSqlTableIntoOracleTable

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

            //take a SQLServer table and create Oracle table DDL
            var gen = new DdlGeneratorFactory(SqlType.Oracle).TableGenerator(table);

            var txt = gen.Write();

            Assert.IsFalse(string.IsNullOrEmpty(txt), "Should have written some text");

            //manually check the script is ok
        }
开发者ID:Petran15,项目名称:dbschemareader,代码行数:13,代码来源:WritingSprocsTest.cs

示例4: BuildAllTableDdl

 public void BuildAllTableDdl(DatabaseSchema databaseSchema)
 {
     var tg = new DdlGeneratorFactory(_sqlType).AllTablesGenerator(databaseSchema);
     tg.IncludeSchema = false;
     try
     {
         var txt = tg.Write();
         Clipboard.SetText(txt, TextDataFormat.UnicodeText);
     }
     catch (Exception exception)
     {
         Debug.WriteLine(exception.Message);
     }
 }
开发者ID:Petran15,项目名称:dbschemareader,代码行数:14,代码来源:SqlTasks.cs


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