internal static Skeleton GetOrCreateSkeleton <T>(T impl, bool addRef)
            where T : class
        {
            if (impl is Skeleton skel)
            {
                return(skel);
            }

            skel = _implMap.GetValue(impl, _ => CapabilityReflection.CreateSkeleton(_));

            if (addRef)
            {
                skel.Claim();
            }

            return(skel);
        }
Example #2
0
        internal static Skeleton GetOrCreateSkeleton <T>(T impl, bool addRef)
            where T : class
        {
            if (impl == null)
            {
                throw new ArgumentNullException(nameof(impl));
            }

            if (impl is Skeleton skel)
            {
                return(skel);
            }

            skel = _implMap.GetValue(impl, _ => CapabilityReflection.CreateSkeleton(_));

            if (addRef)
            {
                skel.Claim();
            }

            return(skel);
        }