本文整理汇总了C#中IScriptable.Script方法的典型用法代码示例。如果您正苦于以下问题:C# IScriptable.Script方法的具体用法?C# IScriptable.Script怎么用?C# IScriptable.Script使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScriptable
的用法示例。
在下文中一共展示了IScriptable.Script方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecreateObject
string RecreateObject(IScriptable scriptableObject, ScriptingOptions sCO)
{
StringBuilder sb = new StringBuilder();
// Generate Drop script
ScriptingOptions so = new ScriptingOptions();
so.ScriptDrops = true;
so.IncludeIfNotExists = true;
foreach (string stmt in scriptableObject.Script(so))
{
sb.AppendLine(stmt);
}
// Add batch separator
sb.AppendLine("GO");
// Now generate Crate script and add it to the resulting ScriptCollection
sCO.ScriptDrops = false;
sCO.IncludeIfNotExists = false;
foreach (string stmt in scriptableObject.Script(sCO))
{
sb.AppendLine(stmt);
if (stmt.Contains("SET ANSI_NULLS") || stmt.Contains("SET QUOTED_IDENTIFIER"))
sb.AppendLine("GO");
}
//for (int i = 0; i < sc.Count; i++)
// sb.Append(sc[i]);
return sb.ToString();
}
示例2: GetScriptText
private static string GetScriptText(IScriptable scriptable)
{
if (scriptable == null)
{
return String.Empty;
}
StringBuilder stringBuilder = new StringBuilder();
StringCollection batches;
try
{
batches = scriptable.Script();
}
catch {
return string.Empty;
}
foreach (string batch in batches)
{
stringBuilder.AppendFormat(@"{0}\r\nGO\r\n", batch);
}
return stringBuilder.ToString();
}
示例3: GetScript
private static string GetScript(IScriptable item)
{
return item.Script().Cast<string>()
.Aggregate(string.Empty, (current, next) => current + Environment.NewLine + next);
}
示例4: WriteDefinition
/// <summary>
///
/// </summary>
/// <param name="scriptable"></param>
public void WriteDefinition(IScriptable scriptable)
{
WriteScript(scriptable.Script(_options));
}