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); 703var parameterSvcId = new ServiceIdentifier(keyed.Key, parameterType); 762public bool IsService(Type serviceType) => IsService(new ServiceIdentifier(null, serviceType)); 764public bool IsKeyedService(Type serviceType, object? key) => IsService(new ServiceIdentifier(key, serviceType)); 783if (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); 61public ServiceIdentifier GetGenericTypeDefinition() => new ServiceIdentifier(ServiceKey, ServiceType.GetGenericTypeDefinition());
ServiceProvider.cs (2)
127return GetService(new ServiceIdentifier(serviceKey, serviceType), serviceProviderEngineScope); 263_serviceAccessors[new ServiceIdentifier(callSite.Key, callSite.ServiceType)] = new ServiceAccessor
69 references to ServiceIdentifier
Microsoft.Extensions.DependencyInjection (69)
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 (36)
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) 233ServiceIdentifier 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); 317Dictionary<ServiceIdentifier, int>? keyedSlotAssignment = null; 328ServiceIdentifier registrationKey = isAnyKeyLookup ? ServiceIdentifier.FromDescriptor(_descriptors[i]) : cacheKey; 345ServiceIdentifier registrationKey = isAnyKeyLookup ? ServiceIdentifier.FromDescriptor(_descriptors[i]) : cacheKey; 369int GetSlot(ServiceIdentifier key) 380keyedSlotAssignment = new Dictionary<ServiceIdentifier, int>(capacity: _descriptors.Length) 397void UpdateSlot(ServiceIdentifier key) 454private ServiceCallSite? TryCreateExact(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, int slot) 467private ServiceCallSite CreateExact(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, int slot) 502private ServiceCallSite? TryCreateOpenGeneric(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, int slot, bool throwOnConstraintViolation) 523private ServiceCallSite? CreateOpenGeneric(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, int slot, bool throwOnConstraintViolation) 562ServiceIdentifier serviceIdentifier, 668ServiceIdentifier serviceIdentifier, 703var parameterSvcId = new ServiceIdentifier(keyed.Key, parameterType); 712callSite ??= GetCallSite(ServiceIdentifier.FromServiceType(parameterType), callSiteChain); 757public void Add(ServiceIdentifier serviceIdentifier, ServiceCallSite serviceCallSite) 766internal 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); 61public 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); 205internal object? GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope) 240private ServiceAccessor CreateServiceAccessor(ServiceIdentifier serviceIdentifier)