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