Esempio n. 1
0
        /// <summary>
        /// Gets a value indicating whether the current <see cref='System.Data.ForeignKeyConstraint'/> is identical to the specified object.
        /// </summary>
        public override bool Equals(object key)
        {
            if (!(key is ForeignKeyConstraint))
            {
                return(false);
            }
            ForeignKeyConstraint key2 = (ForeignKeyConstraint)key;

            // The ParentKey and ChildKey completely identify the ForeignKeyConstraint
            return(ParentKey.ColumnsEqual(key2.ParentKey) && ChildKey.ColumnsEqual(key2.ChildKey));
        }
Esempio n. 2
0
        public void ParentChild()
        {
            var parent = new ParentKey {
                Domain = 100, Id = 101
            };
            var child = new ChildKey {
                Parent = parent, Id = 102
            };

            byte[] parentBytes = Serializer.Serialize(parent);
            byte[] childBytes  = Serializer.Serialize(child);

            Assert.Equal(
                "1, 100, 2, 101, 0",
                string.Join(", ", parentBytes));
            Assert.Equal(
                "1, 100, 2, 101, 0, 3, 102, 0",
                string.Join(", ", childBytes));
        }
Esempio n. 3
0
 /// <include file='doc\ForeignKeyConstraint.uex' path='docs/doc[@for="ForeignKeyConstraint.GetHashCode"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public override Int32 GetHashCode()
 {
     return(ParentKey.GetHashCode() + ChildKey.GetHashCode());
 }