本文整理汇总了C#中SQLScriptList类的典型用法代码示例。如果您正苦于以下问题:C# SQLScriptList类的具体用法?C# SQLScriptList怎么用?C# SQLScriptList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLScriptList类属于命名空间,在下文中一共展示了SQLScriptList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToSqlDiff
public override SQLScriptList ToSqlDiff()
{
SQLScriptList list = new SQLScriptList();
if (this.Status != Enums.ObjectStatusType.OriginalStatus)
RootParent.ActionMessage.Add(this);
if (this.HasState(Enums.ObjectStatusType.DropStatus))
list.Add(Drop());
if (this.HasState(Enums.ObjectStatusType.CreateStatus))
list.Add(Create());
if (this.HasState(Enums.ObjectStatusType.AlterStatus))
{
if (this.HasState(Enums.ObjectStatusType.RebuildDependenciesStatus))
list.AddRange(RebuildDependencys());
if (!this.GetWasInsertInDiffList(Enums.ScripActionType.DropFunction))
{
if (this.HasState(Enums.ObjectStatusType.RebuildStatus))
{
list.Add(Drop());
list.Add(Create());
}
if (this.HasState(Enums.ObjectStatusType.AlterBodyStatus))
{
int iCount = DependenciesCount;
list.Add(ToSQLAlter(), iCount, Enums.ScripActionType.AlterFunction);
}
}
}
return list;
}
示例2: ToSQLChangeColumns
private SQLScriptList ToSQLChangeColumns()
{
Hashtable fields = new Hashtable();
SQLScriptList list = new SQLScriptList();
if ((this.Status == Enums.ObjectStatusType.AlterStatus) || (this.Status == Enums.ObjectStatusType.RebuildStatus))
{
foreach (ObjectDependency dependency in this.Dependencys)
{
ISchemaBase itemDepens = ((Database)this.Parent).Find(dependency.Name);
if (dependency.IsCodeType)
{
list.AddRange(((ICode)itemDepens).Rebuild());
}
if (dependency.Type == Enums.ObjectType.Table)
{
Column column = ((Table)itemDepens).Columns[dependency.ColumnName];
if ((column.Parent.Status != Enums.ObjectStatusType.DropStatus) && (column.Parent.Status != Enums.ObjectStatusType.CreateStatus) && ((column.Status != Enums.ObjectStatusType.CreateStatus)))
{
if (!fields.ContainsKey(column.FullName))
{
if (column.HasToRebuildOnlyConstraint)
column.Parent.Status = Enums.ObjectStatusType.RebuildDependenciesStatus;
list.AddRange(column.RebuildConstraint(true));
list.Add("ALTER TABLE " + column.Parent.FullName + " ALTER COLUMN " + column.ToSQLRedefine(null,0, "") + "\r\nGO\r\n", 0, Enums.ScripActionType.AlterColumn);
/*Si la columna va a ser eliminada o la tabla va a ser reconstruida, no restaura la columna*/
if ((column.Status != Enums.ObjectStatusType.DropStatus) && (column.Parent.Status != Enums.ObjectStatusType.RebuildStatus))
list.AddRange(column.Alter( Enums.ScripActionType.AlterColumnRestore));
fields.Add(column.FullName, column.FullName);
}
}
}
}
}
return list;
}
示例3: ToSqlDiff
public override SQLScriptList ToSqlDiff()
{
SQLScriptList list = new SQLScriptList();
if (this.Status == Enums.ObjectStatusType.DropStatus)
list.Add(Drop());
if (this.Status == Enums.ObjectStatusType.CreateStatus)
list.Add(Create());
if (this.HasState(Enums.ObjectStatusType.AlterStatus))
list.AddRange(Rebuild());
if (this.HasState(Enums.ObjectStatusType.DisabledStatus))
list.Add(this.ToSQLEnabledDisabled(), 0, Enums.ScripActionType.EnabledTrigger);
return list;
}
示例4: ToSqlDiff
/// <summary>
/// Devuelve el schema de diferencias del Schema en formato SQL.
/// </summary>
public override SQLScriptList ToSqlDiff()
{
SQLScriptList listDiff = new SQLScriptList();
if (this.Status == Enums.ObjectStatusType.DropStatus)
{
listDiff.Add(ToSqlDrop(), 0, Enums.ScripActionType.DropSchema);
}
if (this.Status == Enums.ObjectStatusType.CreateStatus)
{
listDiff.Add(ToSql(), 0, Enums.ScripActionType.AddSchema);
}
return listDiff;
}
示例5: ToSqlDiff
/// <summary>
/// Devuelve el schema de diferencias del Schema en formato SQL.
/// </summary>
public override SQLScriptList ToSqlDiff()
{
SQLScriptList list = new SQLScriptList();
if (this.Status != Enums.ObjectStatusType.OriginalStatus)
RootParent.ActionMessage.Add(this);
if (this.HasState(Enums.ObjectStatusType.DropStatus))
list.Add(Drop());
if (this.HasState(Enums.ObjectStatusType.CreateStatus))
list.Add(Create());
if (this.Status == Enums.ObjectStatusType.AlterStatus)
list.Add(ToSQLAlter(), 0, Enums.ScripActionType.AlterProcedure);
return list;
}
示例6: ToSqlDiff
public override SQLScriptList ToSqlDiff()
{
SQLScriptList listDiff = new SQLScriptList();
if (this.Status == Enums.ObjectStatusType.DropStatus)
listDiff.Add(ToSqlDrop(), 0, Enums.ScripActionType.DropAssemblyFile);
if (this.Status == Enums.ObjectStatusType.CreateStatus)
listDiff.Add(ToSqlAdd(), 0, Enums.ScripActionType.AddAssemblyFile);
if (this.HasState(Enums.ObjectStatusType.AlterStatus))
{
listDiff.Add(ToSqlDrop(), 0, Enums.ScripActionType.DropAssemblyFile);
listDiff.Add(ToSqlAdd(), 0, Enums.ScripActionType.AddAssemblyFile);
}
return listDiff;
}
示例7: ToSqlDiff
public override SQLScriptList ToSqlDiff()
{
SQLScriptList list = new SQLScriptList();
if (this.HasState(Enums.ObjectStatusType.DropStatus))
list.Add(Drop());
if (this.HasState(Enums.ObjectStatusType.CreateStatus))
list.Add(Create());
if (this.Status == Enums.ObjectStatusType.AlterStatus)
{
list.AddRange(Rebuild());
}
list.AddRange(this.ExtendedProperties.ToSqlDiff());
return list;
}
示例8: ToSqlDiff
/// <summary>
/// Devuelve el schema de diferencias del Schema en formato SQL.
/// </summary>
public override SQLScriptList ToSqlDiff()
{
SQLScriptList listDiff = new SQLScriptList();
if (this.Status == Enums.ObjectStatusType.DropStatus)
{
listDiff.AddRange(ToSQLUnBindAll());
listDiff.Add(Drop());
}
if (this.Status == Enums.ObjectStatusType.CreateStatus)
listDiff.Add(Create());
if (this.Status == Enums.ObjectStatusType.AlterStatus)
{
listDiff.AddRange(ToSQLUnBindAll());
listDiff.AddRange(Rebuild());
}
return listDiff;
}
示例9: ToSqlDiff
/// <summary>
/// Devuelve el schema de diferencias del Schema en formato SQL.
/// </summary>
public override SQLScriptList ToSqlDiff()
{
SQLScriptList list = new SQLScriptList();
if (this.Status == Enums.ObjectStatusType.DropStatus)
{
list.Add(ToSqlDrop(), 0, Enums.ScripActionType.DropXMLSchema);
}
if (this.Status == Enums.ObjectStatusType.CreateStatus)
{
list.Add(ToSql(), 0, Enums.ScripActionType.AddXMLSchema);
}
if (this.Status == Enums.ObjectStatusType.AlterStatus)
{
list.AddRange(ToSQLChangeColumns());
list.Add(ToSqlDrop() + ToSql(), 0, Enums.ScripActionType.AddXMLSchema);
}
return list;
}
示例10: ToSQLUnBindAll
private SQLScriptList ToSQLUnBindAll()
{
SQLScriptList listDiff = new SQLScriptList();
Hashtable items = new Hashtable();
List<UserDataType> useDataTypes = ((Database)this.Parent).UserTypes.FindAll(item => { return item.Rule.FullName.Equals(this.FullName); });
foreach (UserDataType item in useDataTypes)
{
foreach (ObjectDependency dependency in item.Dependencys)
{
Column column = ((Database)this.Parent).Tables[dependency.Name].Columns[dependency.ColumnName];
if ((!column.IsComputed) && (column.Status != Enums.ObjectStatusType.CreateStatus))
{
if (!items.ContainsKey(column.FullName))
{
listDiff.Add("EXEC sp_unbindrule '" + column.FullName + "'\r\nGO\r\n", 0, Enums.ScripActionType.UnbindRuleColumn);
items.Add(column.FullName, column.FullName);
}
}
}
if (item.Rule.Status != Enums.ObjectStatusType.CreateStatus)
listDiff.Add("EXEC sp_unbindrule '" + item.FullName + "'\r\nGO\r\n", 0, Enums.ScripActionType.UnbindRuleType);
}
return listDiff;
}
示例11: RebuildDependencys
private SQLScriptList RebuildDependencys(List<string> depends, int deepMin, int deepMax)
{
int newDeepMax = (deepMax != 0) ? deepMax + 1 : 0;
int newDeepMin = (deepMin != 0) ? deepMin - 1 : 0;
SQLScriptList list = new SQLScriptList();
for (int j = 0; j < depends.Count; j++)
{
ISchemaBase item = ((Database)Parent).Find(depends[j]);
if (item != null)
{
if ((item.Status != Enums.ObjectStatusType.CreateStatus) && (item.Status != Enums.ObjectStatusType.DropStatus))
{
if ((item.ObjectType != Enums.ObjectType.CLRStoreProcedure) && (item.ObjectType != Enums.ObjectType.Assembly) && (item.ObjectType != Enums.ObjectType.UserDataType) && (item.ObjectType != Enums.ObjectType.View) && (item.ObjectType != Enums.ObjectType.Function))
{
newDeepMin = 0;
newDeepMax = 0;
}
if (item.Status != Enums.ObjectStatusType.DropStatus)
{
if (!((item.Parent.HasState(Enums.ObjectStatusType.RebuildStatus)) && (item.ObjectType == Enums.ObjectType.Trigger)))
list.Add(item.Drop(), newDeepMin);
}
if ((this.Status != Enums.ObjectStatusType.DropStatus) && (item.Status != Enums.ObjectStatusType.CreateStatus))
list.Add(item.Create(), newDeepMax);
if (item.IsCodeType)
list.AddRange(RebuildDependencys(((ICode)item).DependenciesOut, newDeepMin, newDeepMax));
}
}
};
return list;
}
示例12: ToSqlDiff
public override SQLScriptList ToSqlDiff()
{
SQLScriptList list = new SQLScriptList();
if (this.Status != Enums.ObjectStatusType.OriginalStatus)
RootParent.ActionMessage[Parent.FullName].Add(this);
if (this.HasState(Enums.ObjectStatusType.DropStatus))
{
if (this.Parent.Status != Enums.ObjectStatusType.RebuildStatus)
list.Add(Drop());
}
if (this.HasState(Enums.ObjectStatusType.CreateStatus))
list.Add(Create());
if (this.HasState(Enums.ObjectStatusType.AlterStatus))
{
list.Add(Drop());
list.Add(Create());
}
if (this.HasState(Enums.ObjectStatusType.DisabledStatus))
{
list.Add(this.ToSQLEnabledDisabled(), ((Table)Parent).DependenciesCount, Enums.ScripActionType.AlterConstraint);
}
/*if (this.Status == StatusEnum.ObjectStatusType.ChangeFileGroup)
{
list.Add(this.ToSQLDrop(this.Index.FileGroup), ((Table)Parent).DependenciesCount, actionDrop);
list.Add(this.ToSQLAdd(), ((Table)Parent).DependenciesCount, actionAdd);
}*/
return list;
}
示例13: Rebuild
/// <summary>
/// Regenera el objeto, y todos sus objetos dependientes.
/// </summary>
/// <returns></returns>
public SQLScriptList Rebuild()
{
SQLScriptList list = new SQLScriptList();
list.AddRange(RebuildDependencys());
if (this.Status != Enums.ObjectStatusType.CreateStatus) list.Add(Drop(), deepMin);
if (this.Status != Enums.ObjectStatusType.DropStatus) list.Add(Create(), deepMax);
return list;
}
示例14: ToSqlDiff
public override SQLScriptList ToSqlDiff()
{
SQLScriptList list = new SQLScriptList();
if (Status != Enums.ObjectStatusType.OriginalStatus)
RootParent.ActionMessage[Parent.FullName].Add(this);
if (HasState(Enums.ObjectStatusType.DropStatus))
list.Add(Drop());
if (HasState(Enums.ObjectStatusType.CreateStatus))
list.Add(Create());
if (HasState(Enums.ObjectStatusType.AlterStatus))
{
list.Add(Drop());
list.Add(Create());
}
if (Status == Enums.ObjectStatusType.DisabledStatus)
{
list.Add(ToSqlEnabled(), Parent.DependenciesCount, Enums.ScripActionType.AlterIndex);
}
/*if (this.Status == StatusEnum.ObjectStatusType.ChangeFileGroup)
{
listDiff.Add(this.ToSQLDrop(this.FileGroup), ((Table)Parent).DependenciesCount, StatusEnum.ScripActionType.DropIndex);
listDiff.Add(this.ToSQLAdd(), ((Table)Parent).DependenciesCount, StatusEnum.ScripActionType.AddIndex);
}*/
list.AddRange(ExtendedProperties.ToSqlDiff());
return list;
}
示例15: ToSqlDiff
public override SQLScriptList ToSqlDiff(List<ISchemaBase> schemas)
{
var isAzure10 = this.Info.Version == DatabaseInfo.VersionTypeEnum.SQLServerAzure10;
var listDiff = new SQLScriptList();
listDiff.Add(new SQLScript(String.Format(@"/*
Open DBDiff {0}
http://opendbiff.codeplex.com/
Script created by {1}\{2} on {3} at {4}.
Created on: {5}
Source: {6} on {7}
Destination: {8} on {9}
*/
",
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
Environment.UserDomainName,
Environment.UserName,
DateTime.Now.ToShortDateString(),
DateTime.Now.ToLongTimeString(),
Environment.MachineName,
SourceInfo != null ? SourceInfo.Database : "Uknown",
SourceInfo != null ? SourceInfo.Server : "Uknown",
Info != null ? Info.Database : "Uknown",
Info != null ? Info.Server : "Uknown",
0), 0, Enums.ScripActionType.None));
if (!isAzure10)
{
listDiff.Add("USE [" + Name + "]\r\nGO\r\n\r\n", 0, Enums.ScripActionType.UseDatabase);
listDiff.AddRange(Assemblies.ToSqlDiff(schemas));
listDiff.AddRange(UserTypes.ToSqlDiff(schemas));
}
listDiff.AddRange(TablesTypes.ToSqlDiff(schemas));
listDiff.AddRange(Tables.ToSqlDiff(schemas));
listDiff.AddRange(Rules.ToSqlDiff(schemas));
listDiff.AddRange(Schemas.ToSqlDiff(schemas));
listDiff.AddRange(XmlSchemas.ToSqlDiff(schemas));
listDiff.AddRange(Procedures.ToSqlDiff(schemas));
if (!isAzure10)
{
listDiff.AddRange(CLRProcedures.ToSqlDiff(schemas));
listDiff.AddRange(CLRFunctions.ToSqlDiff(schemas));
listDiff.AddRange(FileGroups.ToSqlDiff(schemas));
}
listDiff.AddRange(DDLTriggers.ToSqlDiff(schemas));
listDiff.AddRange(Synonyms.ToSqlDiff(schemas));
listDiff.AddRange(Views.ToSqlDiff(schemas));
listDiff.AddRange(Users.ToSqlDiff(schemas));
listDiff.AddRange(Functions.ToSqlDiff(schemas));
listDiff.AddRange(Roles.ToSqlDiff(schemas));
listDiff.AddRange(PartitionFunctions.ToSqlDiff(schemas));
listDiff.AddRange(PartitionSchemes.ToSqlDiff(schemas));
if (!isAzure10)
{
listDiff.AddRange(FullText.ToSqlDiff(schemas));
}
return listDiff;
}