本文整理汇总了C#中Migrator.Framework.ForeignKeyConstraint类的典型用法代码示例。如果您正苦于以下问题:C# ForeignKeyConstraint类的具体用法?C# ForeignKeyConstraint怎么用?C# ForeignKeyConstraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ForeignKeyConstraint类属于Migrator.Framework命名空间,在下文中一共展示了ForeignKeyConstraint类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddForeignKey
public override void AddForeignKey(string name, string primaryTable, string[] primaryColumns, string refTable,
string[] refColumns, ForeignKeyConstraint constraint)
{
GuardAgainstMaximumIdentifierLengthForOracle(name);
if (ConstraintExists(primaryTable, name))
{
Logger.Warn("Constraint {0} already exists", name);
return;
}
primaryTable = QuoteTableNameIfRequired(primaryTable);
refTable = QuoteTableNameIfRequired(refTable);
string primaryColumnsSql = String.Join(",", primaryColumns.Select(col => QuoteColumnNameIfRequired(col)).ToArray());
string refColumnsSql = String.Join(",", refColumns.Select(col => QuoteColumnNameIfRequired(col)).ToArray());
ExecuteNonQuery(String.Format("ALTER TABLE {0} ADD CONSTRAINT {1} FOREIGN KEY ({2}) REFERENCES {3} ({4})", primaryTable, name, primaryColumnsSql, refTable, refColumnsSql));
}
示例2: GenerateForeignKey
GenerateForeignKey(primaryTable, refTable, ForeignKeyConstraint.NoAction);
}
public void GenerateForeignKey(string primaryTable, string refTable, ForeignKeyConstraint constraint)
示例3: AddForeignKey
public virtual void AddForeignKey(string name, string primaryTable, string[] primaryColumns, string refTable,
string[] refColumns, ForeignKeyConstraint constraint)
{
if (ConstraintExists(primaryTable, name))
{
Logger.Warn("Constraint {0} already exists", name);
return;
}
string constraintResolved = constraintMapper.SqlForConstraint(constraint);
ExecuteNonQuery(
String.Format(
"ALTER TABLE {0} ADD CONSTRAINT {1} FOREIGN KEY ({2}) REFERENCES {3} ({4}) ON UPDATE {5} ON DELETE {6}",
primaryTable, name, String.Join(",", primaryColumns),
refTable, String.Join(",", refColumns), constraintResolved, constraintResolved));
}
示例4: GenerateForeignKey
public void GenerateForeignKey(string primaryTable, string refTable, ForeignKeyConstraint constraint)
{
// No Op
}
示例5: AddForeignKey
public void AddForeignKey(string name, string primaryTable, string[] primaryColumns, string refTable,
string[] refColumns, ForeignKeyConstraint constraint)
{
// No Op
}
示例6: AddForeignKey
public override void AddForeignKey(string name, string primaryTable, string[] primaryColumns, string refTable,
string[] refColumns, ForeignKeyConstraint constraint)
{
// NOOP Because SQLite doesn't support foreign keys
}
示例7: GenerateForeignKey
public void GenerateForeignKey(string foreignTable, string primaryTable, ForeignKeyConstraint constraint)
{
_sqlServerTransformationProvider.GenerateForeignKey(foreignTable, primaryTable, constraint);
}
示例8: AddForeignKey
public void AddForeignKey(string name, string foreignTable, string foreignColumn, string primaryTable, string primaryColumn, ForeignKeyConstraint constraint)
{
_sqlServerTransformationProvider.AddForeignKey(name, foreignTable, foreignColumn, primaryTable, primaryColumn, constraint);
}