Skip to content

Commit

Permalink
Merge pull request #21 from carl-andersson-at-westermo/feature/merge-…
Browse files Browse the repository at this point in the history
…containers

Allowed for containers to be created from other containers, provided they can provide necessary arguments
  • Loading branch information
carl-andersson-at-westermo authored Aug 30, 2024
2 parents ae7bd86 + 42bfbe4 commit 2889a37
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 61 deletions.
5 changes: 4 additions & 1 deletion Benchmarking/Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Benchmarks;
[JsonExporterAttribute.FullCompressed]
public class ResolveBenchmarks
{
private readonly IContainer m_container = new DependencyInjectionContainer(default, default, default!);
private readonly IContainer m_container = new DependencyInjectionContainer(default, default, new NonInjectedClass());

[Benchmark]
public ChainA ResolveChain() => m_container.Resolve<ChainA>();
Expand All @@ -31,6 +31,9 @@ public class ResolveBenchmarks

[Benchmark]
public IContainer Create() => new DependencyInjectionContainer(default, default, default!);

[Benchmark]
public IContainer CreateFromSelf() => new DependencyInjectionContainer(m_container);
}

internal static class Program
Expand Down
2 changes: 2 additions & 0 deletions FactoryGenerator.Attributes/IContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public interface ILifetimeScope : IDisposable

public interface IContainer : ILifetimeScope
{
IContainer? Base { get; }
IContainer? Inheritor { get; set; }
}
Loading

0 comments on commit 2889a37

Please sign in to comment.