Optimization
Method | Mean | Error | StdDev | Median | ---------------- |----------:|----------:|-----------:|----------:| IUnityContainer | 70.14 ns | 2.644 ns | 3.2472 ns | 69.36 ns | Container | 69.50 ns | 1.439 ns | 1.8711 ns | 69.21 ns | Unregistered | 92.20 ns | 1.474 ns | 1.1504 ns | 92.00 ns | Transient | 99.68 ns | 1.016 ns | 0.7936 ns | 99.90 ns | Mapping | 193.21 ns | 4.370 ns | 12.1832 ns | 188.32 ns | Array | 776.40 ns | 14.911 ns | 12.4516 ns | 776.54 ns | Enumerable | 904.25 ns | 17.715 ns | 16.5706 ns | 897.31 ns |
This commit is contained in:
Родитель
ecb66cc06d
Коммит
d2b311a1f9
|
@ -77,9 +77,16 @@ namespace Unity.Strategies
|
|||
|
||||
public override void PostBuildUp(ref BuilderContext context)
|
||||
{
|
||||
var lifetimePolicy = context.Get<LifetimeManager>(context.Registration.Type,
|
||||
context.Registration.Name);
|
||||
lifetimePolicy?.SetValue(context.Existing, context.Lifetime);
|
||||
LifetimeManager policy = null;
|
||||
|
||||
if (context.Registration is ContainerRegistration registration)
|
||||
policy = registration.LifetimeManager;
|
||||
|
||||
if (null == policy || policy is PerResolveLifetimeManager)
|
||||
policy = context.Get<LifetimeManager>(context.Registration.Type,
|
||||
context.Registration.Name);
|
||||
|
||||
policy?.SetValue(context.Existing, context.Lifetime);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Загрузка…
Ссылка в новой задаче