示例#1
0
        public static DerivedET CreateDerivedET(string userName)
        {
            DerivedET derivedET = new DerivedET();

            derivedET.UserName = userName;
            return(derivedET);
        }
示例#2
0
        public void GetAnnotationTargetingPropertyInfo()
        {
            RecordAnnotationType annotationValue = null;

            DerivedET et = new DerivedET()
            {
                UserName = "******",
                ComplexP = new DerivedCT {
                    Name = "DerivedCT", Description = "DerivedET Description"
                },
                DerivedComplexP = new DerivedCT {
                    Name = "DerivedCT1", Description = "DerivedET1 Description"
                }
            };

            var result = dsc.TryGetAnnotation <Func <DerivedCT>, RecordAnnotationType>(
                () => et.DerivedComplexP,
                RecordAnnotation,
                out annotationValue);

            Assert.True(result);
            Assert.Equal("ET", annotationValue.Name);
            Assert.Equal(1, annotationValue.OtherProperties.Count);
            Assert.Equal("DerivedCT", annotationValue.OtherProperties.ElementAt(0));
            Assert.Equal(1, annotationValue.CollectionOfCTP.Count);
            Assert.Equal("DerivedCT", annotationValue.CollectionOfCTP.ElementAt(0).Name);
            Assert.Equal(1, annotationValue.CollectionOfDerivedCTP.Count);
            var derivedCT = annotationValue.CollectionOfCTP.ElementAt(0) as DerivedCT;

            Assert.Equal("DerivedET Description", derivedCT.Description);
        }
        public static DerivedET CreateDerivedET(string ID, int propertyInDerivedET)
        {
            DerivedET derivedET = new DerivedET();

            derivedET.Id = ID;
            derivedET.PropertyInDerivedET = propertyInDerivedET;
            return(derivedET);
        }
 public virtual void AddToDerivedETSet(DerivedET derivedET)
 {
     base.AddObject("DerivedETSet", derivedET);
 }
示例#5
0
        public void GetAnnotationTargetingNavigationProperty()
        {
            IEnumerable <DerivedET> annotationValue = null;

            DerivedET et = new DerivedET()
            {
                UserName = "******",
                ComplexP = new DerivedCT {
                    Name = "DerivedCT", Description = "DerivedET Description"
                },
                DerivedComplexP = new DerivedCT {
                    Name = "DerivedCT1", Description = "DerivedET1 Description"
                },
                NavP = new List <ET>
                {
                    new DerivedET()
                    {
                        UserName = "******",
                        ComplexP = new CT {
                            Name = "DerivedCT"
                        },
                        DerivedComplexP = new DerivedCT {
                            Name = "DerivedCT1", Description = "DerivedET1 Description"
                        },
                        NavP = null,
                    },
                    new DerivedET()
                    {
                        UserName = "******",
                        ComplexP = new CT {
                            Name = "DerivedCT"
                        },
                        NavP = new List <ET>()
                    },
                    new DerivedET()
                    {
                        UserName = "******",
                        ComplexP = new CT {
                            Name = "DerivedCT"
                        }
                    },
                    new ET()
                    {
                        UserName = "******",
                        ComplexP = new DerivedCT {
                            Name = "DerivedCT", Description = "DerivedET Description"
                        },
                    }
                }
            };

            var result = dsc.TryGetAnnotation <Func <ICollection <ET> >, IEnumerable <DerivedET> >(
                () => et.NavP,
                NavOfDerivedETAnnotationTerm,
                out annotationValue);

            Assert.True(result);
            Assert.Equal(3, annotationValue.Count());
            Assert.Equal("DerivedCT1", annotationValue.ElementAt(0).DerivedComplexP.Name);
            Assert.Null(annotationValue.ElementAt(0).NavP);
            Assert.Equal(0, annotationValue.ElementAt(1).NavP.Count);
            Assert.Null(annotationValue.ElementAt(2).DerivedComplexP);
        }