Example #1
0
        public bool EqualsTo(ForeignKeyColumn foreignKeyColumn, ForeignKeyColumn auxiliaryForeignKeyColumn)
        {
            bool isAux = auxiliaryForeignKeyColumn != null;

            Table  ownerTable   = isAux ? foreignKeyColumn.Owner.ForeignTable : (Table)foreignKeyColumn.Owner.Owner;
            string ownerColumn  = isAux ? foreignKeyColumn.ReferencedColumn : foreignKeyColumn.Name;
            Table  foreignTable = isAux ? auxiliaryForeignKeyColumn.Owner.ForeignTable : foreignKeyColumn.Owner.ForeignTable;
            string targetColumn = isAux ? auxiliaryForeignKeyColumn.ReferencedColumn : foreignKeyColumn.ReferencedColumn;

            bool equals = Util.StringEqual(this.OwnerSetting.Table.Urn, ownerTable.Urn, true);

            equals &= Util.StringEqual(this.OwnerSetting.Column, ownerColumn, true);
            equals &= Util.StringEqual(this.TargetSetting.Table.Urn, foreignTable.Urn, true);
            equals &= Util.StringEqual(this.TargetSetting.Column, targetColumn, true);

            return(equals);
        }
Example #2
0
        protected internal override DBObject InternalResolveChildObject(DBObjectUrn childObjectUrn)
        {
            DBObject result = base.InternalResolveChildObject(childObjectUrn);

            if (result != null)
            {
                result = this;

                string foreignKeyColumnName = childObjectUrn[DbItemType.ForeignKeyColumn];
                if (!string.IsNullOrEmpty(foreignKeyColumnName))
                {
                    ForeignKeyColumn foreignKeyColumnObj = this.ForeignKeyColumns.SingleOrDefault(item => Util.StringEqual(item.Name, foreignKeyColumnName, true));
                    if (foreignKeyColumnObj != null)
                    {
                        result = foreignKeyColumnObj.InternalResolveChildObject(childObjectUrn);
                    }
                }

                return(result);
            }

            return(result);
        }
Example #3
0
 public bool EqualsTo(ForeignKeyColumn foreignKeyColumn)
 {
     return(EqualsTo(foreignKeyColumn, null));
 }
Example #4
0
 public AssociationItem(ForeignKeyColumn foreignKeyColumn, AssocationType assocationType)
     : this(foreignKeyColumn, null, assocationType)
 {
 }