コード例 #1
0
        private bool Equals(CompositeEntityKey other)
        {
            if (_entityType != other._entityType)
            {
                return(false);
            }

            var parts      = _keyValueParts;
            var otherParts = other._keyValueParts;

            var partCount = parts.Length;

            if (partCount != otherParts.Length)
            {
                return(false);
            }

            for (var i = 0; i < partCount; i++)
            {
                if (!StructuralComparisons.StructuralEqualityComparer.Equals(parts[i], otherParts[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
0
        private bool Equals(CompositeEntityKey other)
        {
            if (_entityType != other._entityType)
            {
                return false;
            }

            var parts = _keyValueParts;
            var otherParts = other._keyValueParts;

            var partCount = parts.Length;
            if (partCount != otherParts.Length)
            {
                return false;
            }

            for (var i = 0; i < partCount; i++)
            {
                if (!StructuralComparisons.StructuralEqualityComparer.Equals(parts[i], otherParts[i]))
                {
                    return false;
                }
            }

            return true;
        }
コード例 #3
0
        public void Base_class_value_property_returns_same_as_strongly_typed_value_property()
        {
            var key = new CompositeEntityKey(new Mock<IEntityType>().Object, new object[] { 77, "Kake" });

            Assert.Equal(new object[] { 77, "Kake" }, key.Value);
            Assert.Equal(new object[] { 77, "Kake" }, (object[])((EntityKey)key).Value);
        }
コード例 #4
0
        public void Base_class_value_property_returns_same_as_strongly_typed_value_property()
        {
            var key = new CompositeEntityKey(new Mock <IEntityType>().Object, new object[] { 77, "Kake" });

            Assert.Equal(new object[] { 77, "Kake" }, key.Value);
            Assert.Equal(new object[] { 77, "Kake" }, (object[])((EntityKey)key).Value);
        }
コード例 #5
0
 private bool Equals(CompositeEntityKey other)
 {
     return(EntityType == other.EntityType &&
            _keyValueParts.SequenceEqual(other._keyValueParts));
 }