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


C# ISource.Check方法代码示例

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


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

示例1: BuildCommands

 private static IEnumerable<string> BuildCommands(ISource DesiredStructure, ISource CurrentStructure)
 {
     var Commands = new List<string>();
     DesiredStructure = DesiredStructure.Check(new Database(""));
     if (CurrentStructure == null)
         Commands.Add(string.Format(CultureInfo.CurrentCulture,
             "EXEC dbo.sp_executesql @statement = N'CREATE DATABASE {0}'",
             DesiredStructure.Name));
     CurrentStructure = CurrentStructure.Check(new Database(DesiredStructure.Name));
     foreach (Utilities.ORM.Manager.Schema.Default.Database.Table Table in DesiredStructure.Tables)
     {
         ITable CurrentTable = CurrentStructure[Table.Name];
         Commands.Add((CurrentTable == null) ? GetTableCommand(Table) : GetAlterTableCommand(Table, CurrentTable));
     }
     foreach (Utilities.ORM.Manager.Schema.Default.Database.Table Table in DesiredStructure.Tables)
     {
         ITable CurrentTable = CurrentStructure[Table.Name];
         Commands.Add((CurrentTable == null) ? GetForeignKeyCommand(Table) : GetForeignKeyCommand(Table, CurrentTable));
         Commands.Add((CurrentTable == null) ? GetTriggerCommand(Table) : GetAlterTriggerCommand(Table, CurrentTable));
     }
     foreach (Function Function in DesiredStructure.Functions)
     {
         var CurrentFunction = (Function)CurrentStructure.Functions.FirstOrDefault(x => x.Name == Function.Name);
         Commands.Add(CurrentFunction != null ? GetAlterFunctionCommand(Function, CurrentFunction) : GetFunctionCommand(Function));
     }
     foreach (View View in DesiredStructure.Views)
     {
         var CurrentView = (View)CurrentStructure.Views.FirstOrDefault(x => x.Name == View.Name);
         Commands.Add(CurrentView != null ? GetAlterViewCommand(View, CurrentView) : GetViewCommand(View));
     }
     foreach (StoredProcedure StoredProcedure in DesiredStructure.StoredProcedures)
     {
         var CurrentStoredProcedure = (StoredProcedure)CurrentStructure.StoredProcedures.FirstOrDefault(x => x.Name == StoredProcedure.Name);
         Commands.Add(CurrentStoredProcedure != null ? GetAlterStoredProcedure(StoredProcedure, CurrentStoredProcedure) : GetStoredProcedure(StoredProcedure));
     }
     return Commands;
 }
开发者ID:JaCraig,项目名称:Craig-s-Utility-Library,代码行数:37,代码来源:PostgreSQLSchemaGenerator.cs


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