13 instantiations of ServiceIdentifier
Microsoft.Extensions.DependencyInjection (13)
ServiceLookup\CallSiteFactory.cs (7)
219var catchAllIdentifier = new ServiceIdentifier(KeyedService.AnyKey, serviceIdentifier.ServiceType); 242var catchAllIdentifier = new ServiceIdentifier(KeyedService.AnyKey, genericIdentifier.ServiceType); 274var cacheKey = new ServiceIdentifier(serviceIdentifier.ServiceKey, itemType); 593var parameterSvcId = new ServiceIdentifier(keyed.Key, parameterType); 652public bool IsService(Type serviceType) => IsService(new ServiceIdentifier(null, serviceType)); 654public bool IsKeyedService(Type serviceType, object? key) => IsService(new ServiceIdentifier(key, serviceType)); 676if (serviceIdentifier.ServiceKey != null && _descriptorLookup.ContainsKey(new ServiceIdentifier(KeyedService.AnyKey, serviceType)))
ServiceLookup\ServiceCacheKey.cs (1)
31ServiceIdentifier = new ServiceIdentifier(key, type);
ServiceLookup\ServiceIdentifier.cs (3)
27=> new ServiceIdentifier(serviceDescriptor.ServiceKey, serviceDescriptor.ServiceType); 29public static ServiceIdentifier FromServiceType(Type type) => new ServiceIdentifier(null, type); 63public ServiceIdentifier GetGenericTypeDefinition() => new ServiceIdentifier(ServiceKey, ServiceType.GetGenericTypeDefinition());
ServiceProvider.cs (2)
115=> GetService(new ServiceIdentifier(serviceKey, serviceType), serviceProviderEngineScope); 230_serviceAccessors[new ServiceIdentifier(callSite.Key, callSite.ServiceType)] = new ServiceAccessor
59 references to ServiceIdentifier
Microsoft.Extensions.DependencyInjection (59)
ServiceLookup\CallSiteChain.cs (10)
13private readonly Dictionary<ServiceIdentifier, ChainItemInfo> _callSiteChain; 17_callSiteChain = new Dictionary<ServiceIdentifier, ChainItemInfo>(); 20public void CheckCircularDependency(ServiceIdentifier serviceIdentifier) 28public void Remove(ServiceIdentifier serviceIdentifier) 33public void Add(ServiceIdentifier serviceIdentifier, Type? implementationType = null) 38private string CreateCircularDependencyExceptionMessage(ServiceIdentifier serviceIdentifier) 49private void AppendResolutionPath(StringBuilder builder, ServiceIdentifier currentlyResolving) 51var ordered = new List<KeyValuePair<ServiceIdentifier, ChainItemInfo>>(_callSiteChain); 54foreach (KeyValuePair<ServiceIdentifier, ChainItemInfo> pair in ordered) 56ServiceIdentifier serviceIdentifier = pair.Key;
ServiceLookup\CallSiteFactory.cs (26)
19private readonly Dictionary<ServiceIdentifier, ServiceDescriptorCacheItem> _descriptorLookup = new Dictionary<ServiceIdentifier, ServiceDescriptorCacheItem>(); 20private readonly ConcurrentDictionary<ServiceIdentifier, object> _callSiteLocks = new ConcurrentDictionary<ServiceIdentifier, object>(); 83var cacheKey = ServiceIdentifier.FromDescriptor(descriptor); 154if (_descriptorLookup.TryGetValue(ServiceIdentifier.FromDescriptor(serviceDescriptor), out ServiceDescriptorCacheItem item)) 162internal ServiceCallSite? GetCallSite(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain) => 168var serviceIdentifier = ServiceIdentifier.FromDescriptor(serviceDescriptor); 178private ServiceCallSite? CreateCallSite(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain) 209private ServiceCallSite? TryCreateExact(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain) 219var catchAllIdentifier = new ServiceIdentifier(KeyedService.AnyKey, serviceIdentifier.ServiceType); 229private ServiceCallSite? TryCreateOpenGeneric(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain) 233var genericIdentifier = serviceIdentifier.GetGenericTypeDefinition(); 242var catchAllIdentifier = new ServiceIdentifier(KeyedService.AnyKey, genericIdentifier.ServiceType); 253private ServiceCallSite? TryCreateEnumerable(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain) 274var cacheKey = new ServiceIdentifier(serviceIdentifier.ServiceKey, itemType); 370private ServiceCallSite? TryCreateExact(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, int slot) 417private ServiceCallSite? TryCreateOpenGeneric(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, int slot, bool throwOnConstraintViolation) 460ServiceIdentifier serviceIdentifier, 566ServiceIdentifier serviceIdentifier, 593var parameterSvcId = new ServiceIdentifier(keyed.Key, parameterType); 602callSite ??= GetCallSite(ServiceIdentifier.FromServiceType(parameterType), callSiteChain); 647public void Add(ServiceIdentifier serviceIdentifier, ServiceCallSite serviceCallSite) 656internal bool IsService(ServiceIdentifier serviceIdentifier)
ServiceLookup\ILEmit\ILEmitResolverBuilder.cs (1)
279var id = key.ServiceIdentifier;
ServiceLookup\ResultCache.cs (2)
13var cacheKey = new ServiceCacheKey(ServiceIdentifier.FromServiceType(serviceType), 0); 23public ResultCache(ServiceLifetime lifetime, ServiceIdentifier serviceIdentifier, int slot)
ServiceLookup\ServiceCacheKey.cs (2)
14public ServiceIdentifier ServiceIdentifier { get; } 35public ServiceCacheKey(ServiceIdentifier type, int slot)
ServiceLookup\ServiceIdentifier.cs (7)
9internal readonly struct ServiceIdentifier : IEquatable<ServiceIdentifier> 26public static ServiceIdentifier FromDescriptor(ServiceDescriptor serviceDescriptor) 29public static ServiceIdentifier FromServiceType(Type type) => new ServiceIdentifier(null, type); 31public bool Equals(ServiceIdentifier other) 46return obj is ServiceIdentifier && Equals((ServiceIdentifier)obj); 63public ServiceIdentifier GetGenericTypeDefinition() => new ServiceIdentifier(ServiceKey, ServiceType.GetGenericTypeDefinition());
ServiceLookup\ServiceProviderEngineScope.cs (1)
50return RootProvider.GetService(ServiceIdentifier.FromServiceType(serviceType), this);
ServiceProvider.cs (10)
24private readonly Func<ServiceIdentifier, ServiceAccessor> _createServiceAccessor; 31private readonly ConcurrentDictionary<ServiceIdentifier, ServiceAccessor> _serviceAccessors; 58_serviceAccessors = new ConcurrentDictionary<ServiceIdentifier, ServiceAccessor>(); 63CallSiteFactory.Add(ServiceIdentifier.FromServiceType(typeof(IServiceProvider)), new ServiceProviderCallSite()); 64CallSiteFactory.Add(ServiceIdentifier.FromServiceType(typeof(IServiceScopeFactory)), new ConstantCallSite(typeof(IServiceScopeFactory), Root)); 65CallSiteFactory.Add(ServiceIdentifier.FromServiceType(typeof(IServiceProviderIsService)), new ConstantCallSite(typeof(IServiceProviderIsService), CallSiteFactory)); 66CallSiteFactory.Add(ServiceIdentifier.FromServiceType(typeof(IServiceProviderIsKeyedService)), new ConstantCallSite(typeof(IServiceProviderIsKeyedService), CallSiteFactory)); 103public object? GetService(Type serviceType) => GetService(ServiceIdentifier.FromServiceType(serviceType), Root); 172internal object? GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope) 207private ServiceAccessor CreateServiceAccessor(ServiceIdentifier serviceIdentifier)