当前位置: 首页>>代码示例>>C#>>正文


C# Relation.GetOtherEndFromRole方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:17,代码来源:Cases.cs

示例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);
        }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:10,代码来源:Cases.cs

示例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));
 }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:12,代码来源:Cases.cs

示例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);
        }
开发者ID:daszat,项目名称:zetbox,代码行数:21,代码来源:Cases.cs


注:本文中的Relation.GetOtherEndFromRole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。