@@ -9538,11 +9538,6 @@ public static ServiceDetails Of(IfUnresolved ifUnresolved) =>
9538
9538
ifUnresolved == IfUnresolved.ReturnDefault ? IfUnresolvedReturnDefault :
9539
9539
IfUnresolvedReturnDefaultIfNotRegistered;
9540
9540
9541
- /// <summary>Creates new details out of provided settings and not null `serviceKey`.</summary>
9542
- [MethodImpl((MethodImplOptions)256)]
9543
- public static ServiceDetails OfServiceKey(ServiceDetails d, object serviceKey) =>
9544
- new ServiceDetails(d.RequiredServiceType, d.IfUnresolved, serviceKey, d.MetadataKey, d.Metadata, d.DefaultValue, hasCustomValue: false);
9545
-
9546
9541
/// <summary>Creates new details out of provided settings, or returns default if all settings have default value.</summary>
9547
9542
public static ServiceDetails Of(Type requiredServiceType = null,
9548
9543
object serviceKey = null, IfUnresolved ifUnresolved = IfUnresolved.Throw,
@@ -9574,7 +9569,14 @@ public static ServiceDetails OfValue(object value) =>
9574
9569
/// <summary>Sets the service key as a detials of the service resolution.</summary>
9575
9570
[MethodImpl((MethodImplOptions)256)]
9576
9571
public static ServiceDetails OfServiceKey(object serviceKey) =>
9577
- new ServiceDetails(null, IfUnresolved.Throw, serviceKey, null, null, null, false);
9572
+ new ServiceDetails(null, IfUnresolved.Throw, serviceKey, null, null, null,
9573
+ hasCustomValue: false);
9574
+
9575
+ /// <summary>Creates new details out of provided settings and not null `serviceKey`.</summary>
9576
+ [MethodImpl((MethodImplOptions)256)]
9577
+ public static ServiceDetails WithServiceKey(ServiceDetails d, object serviceKey) =>
9578
+ new ServiceDetails(d.RequiredServiceType, d.IfUnresolved, serviceKey, d.MetadataKey, d.Metadata, d.DefaultValue,
9579
+ hasCustomValue: false);
9578
9580
9579
9581
/// <summary>Service type to search in registry. Should be assignable to user requested service type.</summary>
9580
9582
public readonly Type RequiredServiceType;
@@ -9892,17 +9894,14 @@ internal static object OrServiceType(Type serviceType, Type requiredServiceType,
9892
9894
if (serviceType == requiredServiceType)
9893
9895
requiredServiceType = null;
9894
9896
9895
- if (serviceKey == null & requiredServiceType == null & metadataKey == null & metadata == null)
9896
- {
9897
- if (ifUnresolved == IfUnresolved.Throw)
9898
- return serviceType; // todo: @wip
9899
- return ifUnresolved == IfUnresolved.ReturnDefault
9900
- ? new TypedIfUnresolvedReturnDefault(serviceType)
9901
- : new TypedIfUnresolvedReturnDefaultIfNotRegistered(serviceType);
9902
- }
9897
+ if (requiredServiceType == null & serviceKey == null & metadataKey == null & metadata == null)
9898
+ return ifUnresolved == IfUnresolved.Throw ? serviceType
9899
+ : ifUnresolved == IfUnresolved.ReturnDefault
9900
+ ? new TypedIfUnresolvedReturnDefault(serviceType)
9901
+ : new TypedIfUnresolvedReturnDefaultIfNotRegistered(serviceType);
9903
9902
9904
- return new WithDetails(serviceType,
9905
- ServiceDetails.Of(requiredServiceType, serviceKey, ifUnresolved, null, metadataKey, metadata) );
9903
+ var details = new ServiceDetails(requiredServiceType, ifUnresolved, serviceKey, metadataKey, metadata, null, hasCustomValue: false);
9904
+ return new WithDetails(serviceType, details );
9906
9905
}
9907
9906
9908
9907
/// <summary>Typed service info</summary>
@@ -10666,9 +10665,9 @@ public Request WithFlags(RequestFlags newFlags) =>
10666
10665
public void ChangeServiceKey(object serviceKey) =>
10667
10666
ServiceTypeOrInfo
10668
10667
= ServiceTypeOrInfo is ServiceInfo i
10669
- ? i.Create(i.ServiceType, ServiceDetails.OfServiceKey (i.Details, serviceKey)) // todo: @unclear check for the custom value
10668
+ ? i.Create(i.ServiceType, ServiceDetails.WithServiceKey (i.Details, serviceKey)) // todo: @unclear check for the custom value
10670
10669
: ServiceTypeOrInfo is ParameterInfo pi
10671
- ? ParameterServiceInfo.Of(pi, ActualServiceType, ServiceDetails.OfServiceKey (ServiceDetails.Default, serviceKey))
10670
+ ? ParameterServiceInfo.Of(pi, ActualServiceType, ServiceDetails.WithServiceKey (ServiceDetails.Default, serviceKey))
10672
10671
: ServiceInfo.Of(ActualServiceType, serviceKey);
10673
10672
10674
10673
/// <summary>Prepends input arguments to existing arguments in request. It is done because the
0 commit comments