本文整理汇总了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;
}