Esempio n. 1
0
 public virtual IEnumerable <object> LazyGetServices(Type serviceType)
 {
     return((IEnumerable <object>)CachedServices.GetOrAdd(serviceType, () => ServiceProvider.GetServices(serviceType)));
 }
 public virtual object LazyGetService(Type serviceType, Func <IServiceProvider, object> factory)
 {
     return(CachedServices.GetOrAdd(serviceType, () => factory(ServiceProvider)));
 }
Esempio n. 3
0
 public virtual object LazyGetService(Type serviceType)
 {
     return(CachedServices.GetOrAdd(serviceType, () => ServiceProvider.GetService(serviceType)));
 }
 /// <summary>
 /// 获取请求服务
 /// </summary>
 /// <param name="serviceType">服务类型</param>
 public virtual object LazyGetRequiredService(Type serviceType) => CachedServices.GetOrAdd(serviceType, () => ServiceProvider.GetRequiredService(serviceType));