Beispiel #1
0
        public override IFacet GetFacet(Type facetType)
        {
            var facet = base.GetFacet(facetType);

            if (FacetUtils.IsNotANoopFacet(facet))
            {
                return(facet);
            }

            var noopFacet = facet;

            if (Superclass != null)
            {
                var superClassFacet = Superclass.GetFacet(facetType);
                if (FacetUtils.IsNotANoopFacet(superClassFacet))
                {
                    return(superClassFacet);
                }

                noopFacet ??= superClassFacet;
            }

            foreach (var interfaceSpec in Interfaces)
            {
                var interfaceFacet = interfaceSpec.GetFacet(facetType);
                if (FacetUtils.IsNotANoopFacet(interfaceFacet))
                {
                    return(interfaceFacet);
                }

                noopFacet ??= interfaceFacet;
            }

            return(noopFacet);
        }
        public override IFacet GetFacet(Type facetType)
        {
            IFacet facet = base.GetFacet(facetType);

            if (FacetUtils.IsNotANoopFacet(facet))
            {
                return(facet);
            }

            IFacet noopFacet = facet;

            if (Superclass != null)
            {
                IFacet superClassFacet = Superclass.GetFacet(facetType);
                if (FacetUtils.IsNotANoopFacet(superClassFacet))
                {
                    return(superClassFacet);
                }
                if (noopFacet == null)
                {
                    noopFacet = superClassFacet;
                }
            }

            foreach (var interfaceSpec in Interfaces)
            {
                IFacet interfaceFacet = interfaceSpec.GetFacet(facetType);
                if (FacetUtils.IsNotANoopFacet(interfaceFacet))
                {
                    return(interfaceFacet);
                }
                if (noopFacet == null)
                {
                    noopFacet = interfaceFacet;
                }
            }

            return(noopFacet);
        }