예제 #1
0
        public void WhenTheDomainContainsMoreImplsThenMatch()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <MyEntity>();
            orm.TablePerClass <MyRoot1>();
            orm.TablePerClass <MyRelatedRoot2>();

            orm.AddToDomain(typeof(MyRelatedNoRoot1));

            var pattern = new PolymorphismBidirectionalAnyToManyPattern(orm);

            pattern.Match(ForClass <MyRelatedNoRoot1> .Property(x => x.Items)).Should().Be.True();
            pattern.Match(ForClass <MyRelatedRoot2> .Property(x => x.Items)).Should().Be.True();
        }
예제 #2
0
        public void WhenTheDomainDoesNotContainMoreImplsThenNoMatch()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <MyEntity>();
            orm.TablePerClass <MyRelatedRoot1>();

            var pattern = new PolymorphismBidirectionalAnyToManyPattern(orm);

            pattern.Match(ForClass <MyRelatedRoot1> .Property(x => x.Items)).Should().Be.False();
        }
예제 #3
0
        public void WhenManySideIsNotAnEntityThenNoMatch()
        {
            var orm = new ObjectRelationalMapper();

            orm.TablePerClass <MyRelatedRoot1>();
            orm.TablePerClass <MyRelatedRoot2>();

            var pattern = new PolymorphismBidirectionalAnyToManyPattern(orm);

            pattern.Match(ForClass <MyRelatedRoot1> .Property(x => x.Items)).Should().Be.False();
        }
예제 #4
0
        public virtual bool Match(PropertyPath subject)
        {
            var property = subject.LocalMember;

            return(Match(property) && !polymorphismBidirectionalAnyToManyPattern.Match(property));
        }