コード例 #1
0
        private (IAssociationSpecImmutable[], IImmutableDictionary <string, ITypeSpecBuilder>) FindAndCreateFieldSpecs(IObjectSpecImmutable spec, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
        {
            // now create fieldSpecs for value properties, for collections and for reference properties
            var collectionProperties = FacetFactorySet.FindCollectionProperties(properties, ClassStrategy).Where(pi => !FacetFactorySet.Filters(pi, ClassStrategy)).ToArray();
            IEnumerable <IAssociationSpecImmutable> collectionSpecs;

            (collectionSpecs, metamodel) = CreateCollectionSpecs(collectionProperties, spec, metamodel);

            // every other accessor is assumed to be a reference property.
            var allProperties = FacetFactorySet.FindProperties(properties, ClassStrategy).Where(pi => !FacetFactorySet.Filters(pi, ClassStrategy)).ToArray();
            var refProperties = allProperties.Except(collectionProperties);

            IEnumerable <IAssociationSpecImmutable> refSpecs;

            (refSpecs, metamodel) = CreateRefPropertySpecs(refProperties, spec, metamodel);

            return(collectionSpecs.Union(refSpecs).ToArray(), metamodel);
        }
コード例 #2
0
        private Tuple <IAssociationSpecImmutable[], IImmutableDictionary <string, ITypeSpecBuilder> > FindAndCreateFieldSpecs(IObjectSpecImmutable spec, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
        {
            // now create fieldSpecs for value properties, for collections and for reference properties
            IList <PropertyInfo> collectionProperties = FacetFactorySet.FindCollectionProperties(properties, ClassStrategy).Where(pi => !FacetFactorySet.Filters(pi, ClassStrategy)).ToArray();
            var result1 = CreateCollectionSpecs(collectionProperties, spec, metamodel);

            IEnumerable <IAssociationSpecImmutable> collectionSpecs = result1.Item1;

            metamodel = result1.Item2;

            // every other accessor is assumed to be a reference property.
            IList <PropertyInfo>       allProperties = FacetFactorySet.FindProperties(properties, ClassStrategy).Where(pi => !FacetFactorySet.Filters(pi, ClassStrategy)).ToArray();
            IEnumerable <PropertyInfo> refProperties = allProperties.Except(collectionProperties);

            var result   = CreateRefPropertySpecs(refProperties, spec, metamodel);
            var refSpecs = result.Item1;

            metamodel = result.Item2;

            return(new Tuple <IAssociationSpecImmutable[], IImmutableDictionary <string, ITypeSpecBuilder> >(collectionSpecs.Union(refSpecs).ToArray(), metamodel));
        }