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) }; } }