本文整理匯總了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);
}