Exemple #1
0
 // This constructor is called exclusively to create a child scope from the parent
 internal ServiceProvider2(ServiceProvider2 parent)
 {
     Root               = parent.Root;
     ResolvedServices   = new Dictionary <object, object>();
     CallSiteFactory    = parent.CallSiteFactory;
     RealizedServices   = parent.RealizedServices;
     _callSiteValidator = parent._callSiteValidator;
 }
Exemple #2
0
        private static Func <ServiceProvider2, object> CreateServiceAccessor(Type serviceType, ServiceProvider2 serviceProvider)
        {
            var callSite = serviceProvider.CallSiteFactory.CreateCallSite(serviceType, new HashSet <Type>());

            if (callSite != null)
            {
                serviceProvider._callSiteValidator?.ValidateCallSite(serviceType, callSite);
                return(RealizeService(serviceType, callSite));
            }

            return(_ => null);
        }