From e80f94746647b387e00d471dfb49cd0db8a1d349 Mon Sep 17 00:00:00 2001 From: Nikolay Pianikov Date: Wed, 24 Apr 2024 23:26:41 +0300 Subject: [PATCH] Monor --- src/Pure.DI.Core/Components/Api.g.cs | 6 +++--- src/Pure.DI.Core/Core/BindingBuilder.cs | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Pure.DI.Core/Components/Api.g.cs b/src/Pure.DI.Core/Components/Api.g.cs index 06b4b8106..e3889a50e 100644 --- a/src/Pure.DI.Core/Components/Api.g.cs +++ b/src/Pure.DI.Core/Components/Api.g.cs @@ -1102,7 +1102,7 @@ public interface IOwned : global::System.IDisposable [global::System.Diagnostics.DebuggerTypeProxy(typeof(global::Pure.DI.Owned.DebugView))] internal partial class Owned : global::Pure.DI.IOwned { - private global::System.Collections.Generic.List _disposables = new global::System.Collections.Generic.List(); + private global::System.Collections.Generic.List _disposables = new global::System.Collections.Generic.List(); /// /// Adds a disposable instance. @@ -1175,9 +1175,9 @@ public DebugView(global::Pure.DI.Owned owned) /// The value. /// public readonly T Value; - private readonly IOwned _owned; + private readonly global::Pure.DI.IOwned _owned; - public Owned(T value, IOwned owned) + public Owned(T value, global::Pure.DI.IOwned owned) { Value = value; _owned = owned; diff --git a/src/Pure.DI.Core/Core/BindingBuilder.cs b/src/Pure.DI.Core/Core/BindingBuilder.cs index 39241049c..9b54bfed1 100644 --- a/src/Pure.DI.Core/Core/BindingBuilder.cs +++ b/src/Pure.DI.Core/Core/BindingBuilder.cs @@ -113,13 +113,14 @@ public MdBinding Build(MdSetup setup) } } + var id = new Lazy(idGenerator.Generate); return new MdBinding( 0, source, setup, semanticModel, - _contracts.Select(i => i with { Tags = i.Tags.Select(tag => BuildTag(tag, type)).ToImmutableArray()}).ToImmutableArray(), - _tags.Select(tag => BuildTag(tag, type)).ToImmutableArray(), + _contracts.Select(i => i with { Tags = i.Tags.Select(tag => BuildTag(tag, type, id)).ToImmutableArray()}).ToImmutableArray(), + _tags.Select(tag => BuildTag(tag, type, id)).ToImmutableArray(), _lifetime ?? _defaultLifetime?.Lifetime, _implementation, _factory, @@ -141,7 +142,7 @@ public MdBinding Build(MdSetup setup) } } - private MdTag BuildTag(MdTag tag, ITypeSymbol? type) + private static MdTag BuildTag(MdTag tag, ITypeSymbol? type, Lazy id) { if (type is null || tag.Value is null) { @@ -157,7 +158,7 @@ private MdTag BuildTag(MdTag tag, ITypeSymbol? type) return tag with { Value = type }; case Tag.Unique: - return tag with { Value = new UniqueTag(idGenerator.Generate()) }; + return tag with { Value = new UniqueTag(id.Value) }; } }