本文整理汇总了C#中Relation.GetOtherEndFromRole方法的典型用法代码示例。如果您正苦于以下问题:C# Relation.GetOtherEndFromRole方法的具体用法?C# Relation.GetOtherEndFromRole怎么用?C# Relation.GetOtherEndFromRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relation
的用法示例。
在下文中一共展示了Relation.GetOtherEndFromRole方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Do1_1_RelationChange_FromNotNullable_To_Nullable
public void Do1_1_RelationChange_FromNotNullable_To_Nullable(Relation rel, RelationEndRole role)
{
RelationEnd relEnd = rel.GetEndFromRole(role);
RelationEnd otherEnd = rel.GetOtherEndFromRole(role);
var tblName = db.GetTableName(relEnd.Type.Module.SchemaName, relEnd.Type.TableName);
var colName = Construct.ForeignKeyColumnName(otherEnd);
if (db.CheckColumnContainsNulls(tblName, colName))
{
Log.ErrorFormat("column '{0}.{1}' contains NULL values, cannot set NOT NULLABLE", tblName, colName);
}
else
{
db.AlterColumn(tblName, colName, System.Data.DbType.Int32, 0, 0, otherEnd.IsNullable(), null);
}
}
示例2: Do1_1_RelationChange_FromNullable_To_NotNullable
public void Do1_1_RelationChange_FromNullable_To_NotNullable(Relation rel, RelationEndRole role)
{
RelationEnd relEnd = rel.GetEndFromRole(role);
RelationEnd otherEnd = rel.GetOtherEndFromRole(role);
var tblName = db.GetTableName(relEnd.Type.Module.SchemaName, relEnd.Type.TableName);
var colName = Construct.ForeignKeyColumnName(otherEnd);
db.AlterColumn(tblName, colName, System.Data.DbType.Int32, 0, 0, otherEnd.IsNullable(), null);
}
示例3: Is1_1_RelationChange_FromNullable_To_NotNullable
public bool Is1_1_RelationChange_FromNullable_To_NotNullable(Relation rel, RelationEndRole role)
{
Relation savedRel = savedSchema.FindPersistenceObject<Relation>(rel.ExportGuid);
if (savedRel == null)
{
return false;
}
return savedRel.GetOtherEndFromRole(role).IsNullable() && !rel.GetOtherEndFromRole(role).IsNullable()
&& ((rel.Storage == StorageType.MergeIntoA && role == RelationEndRole.A)
|| (rel.Storage == StorageType.MergeIntoB && role == RelationEndRole.B)
|| (rel.Storage == StorageType.Replicate));
}
示例4: Do_1_1_RelationChange_FromNullable_To_NotNullable
public void Do_1_1_RelationChange_FromNullable_To_NotNullable(Relation rel, RelationEndRole role)
{
var savedRel = savedSchema.FindPersistenceObject<Relation>(rel.ExportGuid);
if (!PreMigration(RelationMigrationEventType.ChangeToNotNullable, savedRel, rel))
return;
RelationEnd relEnd = rel.GetEndFromRole(role);
RelationEnd otherEnd = rel.GetOtherEndFromRole(role);
var tblName = relEnd.Type.GetTableRef(db);
var colName = Construct.ForeignKeyColumnName(otherEnd);
var idxName = Construct.IndexName(tblName.Name, colName);
// MS SQL Server (and Postgres?) cannot alter columns when a index exists
if (db.CheckIndexExists(tblName, idxName)) db.DropIndex(tblName, idxName);
db.AlterColumn(tblName, colName, System.Data.DbType.Int32, 0, 0, otherEnd.IsNullable(), null);
db.CreateIndex(tblName, idxName, false, false, colName);
PostMigration(RelationMigrationEventType.ChangeToNotNullable, savedRel, rel);
}