Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed May 16, 2024
1 parent 555887b commit d7cafd5
Show file tree
Hide file tree
Showing 23 changed files with 227 additions and 174 deletions.
14 changes: 7 additions & 7 deletions readme/ArrayDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ partial class Array
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public partialCompositionRoot TestPureDIByCR()
public partial CompositionRoot TestPureDIByCR()
{
return newCompositionRoot(newService1(newService2Array(newIService3[4] { newService3(newService4(), newService4()), newService3v2(newService4(), newService4()), newService3v3(newService4(), newService4()), newService3v4(newService4(), newService4()) })), newService2Array(newIService3[4] { newService3(newService4(), newService4()), newService3v2(newService4(), newService4()), newService3v3(newService4(), newService4()), newService3v4(newService4(), newService4()) }), newService2Array(newIService3[4] { newService3(newService4(), newService4()), newService3v2(newService4(), newService4()), newService3v3(newService4(), newService4()), newService3v4(newService4(), newService4()) }), newService2Array(newIService3[4] { newService3(newService4(), newService4()), newService3v2(newService4(), newService4()), newService3v3(newService4(), newService4()), newService3v4(newService4(), newService4()) }), newService3(newService4(), newService4()), newService4(), newService4());
return new CompositionRoot(new Service1(new Service2Array(new IService3[4] { new Service3(new Service4(), new Service4()), new Service3v2(new Service4(), new Service4()), new Service3v3(new Service4(), new Service4()), new Service3v4(new Service4(), new Service4()) })), new Service2Array(new IService3[4] { new Service3(new Service4(), new Service4()), new Service3v2(new Service4(), new Service4()), new Service3v3(new Service4(), new Service4()), new Service3v4(new Service4(), new Service4()) }), new Service2Array(new IService3[4] { new Service3(new Service4(), new Service4()), new Service3v2(new Service4(), new Service4()), new Service3v3(new Service4(), new Service4()), new Service3v4(new Service4(), new Service4()) }), new Service2Array(new IService3[4] { new Service3(new Service4(), new Service4()), new Service3v2(new Service4(), new Service4()), new Service3v3(new Service4(), new Service4()), new Service3v4(new Service4(), new Service4()) }), new Service3(new Service4(), new Service4()), new Service4(), new Service4());
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down Expand Up @@ -165,13 +165,13 @@ partial class Array
static Array()
{
var valResolver_0000 = new Resolver_0000();
Resolver<Benchmarks.Model.CompositionRoot>.Value = valResolver_0000;
Resolver<CompositionRoot>.Value = valResolver_0000;
_buckets = Buckets<Type, IResolver<Array, object>>.Create(
1,
out _bucketSize,
new Pair<Type, IResolver<Array, object>>[1]
{
new Pair<Type, IResolver<Array, object>>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000)
new Pair<Type, IResolver<Array, object>>(typeof(CompositionRoot), valResolver_0000)
});
}

Expand All @@ -193,14 +193,14 @@ partial class Array
}
}

private sealed class Resolver_0000: Resolver<Benchmarks.Model.CompositionRoot>
private sealed class Resolver_0000: Resolver<CompositionRoot>
{
public overrideCompositionRoot Resolve(Array composition)
public override CompositionRoot Resolve(Array composition)
{
return composition.TestPureDIByCR();
}

public overrideCompositionRoot ResolveByTag(Array composition, object tag)
public override CompositionRoot ResolveByTag(Array composition, object tag)
{
switch (tag)
{
Expand Down
26 changes: 13 additions & 13 deletions readme/EnumDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ partial class Enum
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public partialCompositionRoot TestPureDIByCR()
public partial CompositionRoot TestPureDIByCR()
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
IEnumerable<Benchmarks.Model.IService3> EnumerationOf_perBlockIEnumerable10()
IEnumerable<IService3> EnumerationOf_perBlockIEnumerable10()
{
yield return newService3(newService4(), newService4());
yield return newService3v2(newService4(), newService4());
yield return newService3v3(newService4(), newService4());
yield return newService3v4(newService4(), newService4());
yield return new Service3(new Service4(), new Service4());
yield return new Service3v2(new Service4(), new Service4());
yield return new Service3v3(new Service4(), new Service4());
yield return new Service3v4(new Service4(), new Service4());
}

IEnumerable<Benchmarks.Model.IService3> perBlockIEnumerable10 = EnumerationOf_perBlockIEnumerable10();
return newCompositionRoot(newService1(newService2Enum(perBlockIEnumerable10)), newService2Enum(perBlockIEnumerable10), newService2Enum(perBlockIEnumerable10), newService2Enum(perBlockIEnumerable10), newService3(newService4(), newService4()), newService4(), newService4());
IEnumerable<IService3> perBlockIEnumerable10 = EnumerationOf_perBlockIEnumerable10();
return new CompositionRoot(new Service1(new Service2Enum(perBlockIEnumerable10)), new Service2Enum(perBlockIEnumerable10), new Service2Enum(perBlockIEnumerable10), new Service2Enum(perBlockIEnumerable10), new Service3(new Service4(), new Service4()), new Service4(), new Service4());
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down Expand Up @@ -175,13 +175,13 @@ partial class Enum
static Enum()
{
var valResolver_0000 = new Resolver_0000();
Resolver<Benchmarks.Model.CompositionRoot>.Value = valResolver_0000;
Resolver<CompositionRoot>.Value = valResolver_0000;
_buckets = Buckets<Type, IResolver<Enum, object>>.Create(
1,
out _bucketSize,
new Pair<Type, IResolver<Enum, object>>[1]
{
new Pair<Type, IResolver<Enum, object>>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000)
new Pair<Type, IResolver<Enum, object>>(typeof(CompositionRoot), valResolver_0000)
});
}

Expand All @@ -203,14 +203,14 @@ partial class Enum
}
}

private sealed class Resolver_0000: Resolver<Benchmarks.Model.CompositionRoot>
private sealed class Resolver_0000: Resolver<CompositionRoot>
{
public overrideCompositionRoot Resolve(Enum composition)
public override CompositionRoot Resolve(Enum composition)
{
return composition.TestPureDIByCR();
}

public overrideCompositionRoot ResolveByTag(Enum composition, object tag)
public override CompositionRoot ResolveByTag(Enum composition, object tag)
{
switch (tag)
{
Expand Down
18 changes: 9 additions & 9 deletions readme/FuncDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ partial class Func
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public partialCompositionRoot TestPureDIByCR()
public partial CompositionRoot TestPureDIByCR()
{
Func<Benchmarks.Model.IService3> perBlockFunc10 = new Func<Benchmarks.Model.IService3>(
Func<IService3> perBlockFunc10 = new Func<IService3>(
[MethodImpl(MethodImplOptions.AggressiveInlining)]
() =>
{
var localValue0 = newService3(newService4(), newService4());
var localValue0 = new Service3(new Service4(), new Service4());
return localValue0;
});
return newCompositionRoot(newService1(newService2Func(perBlockFunc10)), newService2Func(perBlockFunc10), newService2Func(perBlockFunc10), newService2Func(perBlockFunc10), newService3(newService4(), newService4()), newService4(), newService4());
return new CompositionRoot(new Service1(new Service2Func(perBlockFunc10)), new Service2Func(perBlockFunc10), new Service2Func(perBlockFunc10), new Service2Func(perBlockFunc10), new Service3(new Service4(), new Service4()), new Service4(), new Service4());
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down Expand Up @@ -154,13 +154,13 @@ partial class Func
static Func()
{
var valResolver_0000 = new Resolver_0000();
Resolver<Benchmarks.Model.CompositionRoot>.Value = valResolver_0000;
Resolver<CompositionRoot>.Value = valResolver_0000;
_buckets = Buckets<Type, IResolver<Func, object>>.Create(
1,
out _bucketSize,
new Pair<Type, IResolver<Func, object>>[1]
{
new Pair<Type, IResolver<Func, object>>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000)
new Pair<Type, IResolver<Func, object>>(typeof(CompositionRoot), valResolver_0000)
});
}

Expand All @@ -182,14 +182,14 @@ partial class Func
}
}

private sealed class Resolver_0000: Resolver<Benchmarks.Model.CompositionRoot>
private sealed class Resolver_0000: Resolver<CompositionRoot>
{
public overrideCompositionRoot Resolve(Func composition)
public override CompositionRoot Resolve(Func composition)
{
return composition.TestPureDIByCR();
}

public overrideCompositionRoot ResolveByTag(Func composition, object tag)
public override CompositionRoot ResolveByTag(Func composition, object tag)
{
switch (tag)
{
Expand Down
22 changes: 11 additions & 11 deletions readme/SingletonDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ partial class Singleton
{
private readonly Singleton _root;

privateService1? _scopedService137;
privateService4? _scopedService440;
private Service1? _scopedService137;
private Service4? _scopedService440;

public Singleton()
{
Expand All @@ -77,19 +77,19 @@ partial class Singleton
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public partialCompositionRoot TestPureDIByCR()
public partial CompositionRoot TestPureDIByCR()
{
if (_scopedService440 == null)
{
_scopedService440 = newService4();
_scopedService440 = new Service4();
}

if (_scopedService137 == null)
{
_scopedService137 = newService1(newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)));
_scopedService137 = new Service1(new Service2(new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!)));
}

return newCompositionRoot(_scopedService137!, newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService2(newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!), newService3(_scopedService440!, _scopedService440!)), newService3(_scopedService440!, _scopedService440!), _scopedService440!, _scopedService440!);
return new CompositionRoot(_scopedService137!, new Service2(new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!)), new Service2(new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!)), new Service2(new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!), new Service3(_scopedService440!, _scopedService440!)), new Service3(_scopedService440!, _scopedService440!), _scopedService440!, _scopedService440!);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down Expand Up @@ -158,13 +158,13 @@ partial class Singleton
static Singleton()
{
var valResolver_0000 = new Resolver_0000();
Resolver<Benchmarks.Model.CompositionRoot>.Value = valResolver_0000;
Resolver<CompositionRoot>.Value = valResolver_0000;
_buckets = Buckets<Type, IResolver<Singleton, object>>.Create(
1,
out _bucketSize,
new Pair<Type, IResolver<Singleton, object>>[1]
{
new Pair<Type, IResolver<Singleton, object>>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000)
new Pair<Type, IResolver<Singleton, object>>(typeof(CompositionRoot), valResolver_0000)
});
}

Expand All @@ -186,14 +186,14 @@ partial class Singleton
}
}

private sealed class Resolver_0000: Resolver<Benchmarks.Model.CompositionRoot>
private sealed class Resolver_0000: Resolver<CompositionRoot>
{
public overrideCompositionRoot Resolve(Singleton composition)
public override CompositionRoot Resolve(Singleton composition)
{
return composition.TestPureDIByCR();
}

public overrideCompositionRoot ResolveByTag(Singleton composition, object tag)
public override CompositionRoot ResolveByTag(Singleton composition, object tag)
{
switch (tag)
{
Expand Down
14 changes: 7 additions & 7 deletions readme/TransientDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ partial class Transient
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public partialCompositionRoot TestPureDIByCR()
public partial CompositionRoot TestPureDIByCR()
{
return newCompositionRoot(newService1(newService2(newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()))), newService2(newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4())), newService2(newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4())), newService2(newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4()), newService3(newService4(), newService4())), newService3(newService4(), newService4()), newService4(), newService4());
return new CompositionRoot(new Service1(new Service2(new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()))), new Service2(new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4())), new Service2(new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4())), new Service2(new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4()), new Service3(new Service4(), new Service4())), new Service3(new Service4(), new Service4()), new Service4(), new Service4());
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down Expand Up @@ -145,13 +145,13 @@ partial class Transient
static Transient()
{
var valResolver_0000 = new Resolver_0000();
Resolver<Benchmarks.Model.CompositionRoot>.Value = valResolver_0000;
Resolver<CompositionRoot>.Value = valResolver_0000;
_buckets = Buckets<Type, IResolver<Transient, object>>.Create(
1,
out _bucketSize,
new Pair<Type, IResolver<Transient, object>>[1]
{
new Pair<Type, IResolver<Transient, object>>(typeof(Benchmarks.Model.CompositionRoot), valResolver_0000)
new Pair<Type, IResolver<Transient, object>>(typeof(CompositionRoot), valResolver_0000)
});
}

Expand All @@ -173,14 +173,14 @@ partial class Transient
}
}

private sealed class Resolver_0000: Resolver<Benchmarks.Model.CompositionRoot>
private sealed class Resolver_0000: Resolver<CompositionRoot>
{
public overrideCompositionRoot Resolve(Transient composition)
public override CompositionRoot Resolve(Transient composition)
{
return composition.TestPureDIByCR();
}

public overrideCompositionRoot ResolveByTag(Transient composition, object tag)
public override CompositionRoot ResolveByTag(Transient composition, object tag)
{
switch (tag)
{
Expand Down
12 changes: 6 additions & 6 deletions readme/class-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ DI.Setup(nameof(Composition))
.Bind<IDependency>().To<Dependency>()
.Bind<IService>().To<Service>()

// Composition root
.Root<IService>("Root")
// Composition root "MyRoot"
.Root<IService>("MyRoot")

// Some kind of identifier
.Arg<int>("id")
Expand All @@ -57,7 +57,7 @@ DI.Setup(nameof(Composition))
var composition = new Composition(id: 123, serviceName: "Abc", dependencyName: "Xyz");

// service = new Service("Abc", new Dependency(123, "Xyz"));
var service = composition.Root;
var service = composition.MyRoot;

service.Name.ShouldBe("Abc");
service.Dependency.Id.ShouldBe(123);
Expand Down Expand Up @@ -91,7 +91,7 @@ partial class Composition
_argDependencyName = _root._argDependencyName;
}

public IService Root
public IService MyRoot
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
Expand All @@ -108,7 +108,7 @@ Class diagram:
classDiagram
class Composition {
<<partial>>
+IService Root
+IService MyRoot
}
class Int32
class String
Expand All @@ -130,6 +130,6 @@ classDiagram
Dependency o-- String : Argument "dependencyName"
Service o-- String : "my service name" Argument "serviceName"
Service *-- Dependency : IDependency
Composition ..> Service : IService Root
Composition ..> Service : IService MyRoot
```

Loading

0 comments on commit d7cafd5

Please sign in to comment.