Beispiel #1
0
        public static ObjectViewParameterLoader TryCreate(
            MetadataObjectView view,
            string name)
        {
            MetadataVirtualProperty metadataVirtualProperty = view.VirtualProperties.Find(name);

            if (metadataVirtualProperty == null)
            {
                return((ObjectViewParameterLoader)null);
            }
            MemberValueGetter memberValueGetter = metadataVirtualProperty.RefMemberType != MetadataClassMember.ObjectView ? (MemberValueGetter) new PropertyValueGetter(metadataVirtualProperty.RefMemberName) : (MemberValueGetter) new ObjectViewTextGetter(metadataVirtualProperty.RefMemberName);

            if (metadataVirtualProperty.SourceMember is MetadataAssociation sourceMember)
            {
                return((ObjectViewParameterLoader) new ObjectViewVirtualPropertyLoader(new Navigator[1]
                {
                    (Navigator) new AssociationNavigator(sourceMember.Property.Name, (MetadataClass)null)
                }, memberValueGetter, ObjectViewVirtualPropertyLoader.ValueCardinality.Single));
            }
            if (!(metadataVirtualProperty.SourceMember is MetadataChildRef sourceMember))
            {
                return((ObjectViewParameterLoader) new ObjectViewVirtualPropertyLoader(Navigator.ParseNavigation(view.Class, metadataVirtualProperty.SourceNavigation), memberValueGetter, ObjectViewVirtualPropertyLoader.ValueCardinality.Multiple));
            }
            return((ObjectViewParameterLoader) new ObjectViewVirtualPropertyLoader(new Navigator[1]
            {
                (Navigator) new ChildRefNavigator(sourceMember.ChildClass)
            }, memberValueGetter, ObjectViewVirtualPropertyLoader.ValueCardinality.Multiple));
        }
Beispiel #2
0
 private ObjectViewVirtualPropertyLoader(
     Navigator[] navigation,
     MemberValueGetter memberValueGetter,
     ObjectViewVirtualPropertyLoader.ValueCardinality valueCardinality)
 {
     this.FNavigation        = navigation;
     this.FMemberValueGetter = memberValueGetter;
     this.FValueCardinality  = valueCardinality;
 }