Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Mar 15, 2024
1 parent a876f31 commit 21794f0
Show file tree
Hide file tree
Showing 75 changed files with 19 additions and 7,177 deletions.
11 changes: 11 additions & 0 deletions build/ReadmeTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,17 @@ private static async Task AddExample(string logsDirectory, string exampleSearchP
.SkipWhile(i => i != "}")
.Skip(1)
.Reverse()
.Where(i =>
{
var line = i.TrimStart();
return !(
line.StartsWith("///")
|| line.StartsWith("#if ")
|| line.StartsWith("[global::System.Diagnostics.")
|| line.StartsWith("#endif")
|| line.StartsWith("#region")
|| line.StartsWith("#endregion"));
})
.Select(i => i.Length > 2 ? i[2..] : i));
await examplesWriter.WriteLineAsync(generatedCode);
await examplesWriter.WriteLineAsync("```");
Expand Down
94 changes: 0 additions & 94 deletions readme/ArrayDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,114 +86,35 @@ classDiagram
<summary>Pure.DI-generated partial class Array</summary><blockquote>

```c#
/// <para>
/// <b>Composition roots</b><br/>
/// <list type="table">
/// <listheader>
/// <term>Root</term>
/// <description>Description</description>
/// </listheader>
/// <item>
/// <term>
/// <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/> <see cref="PureDIByCR()"/><br/>or using <see cref="Resolve{T}()"/> method: <c>Resolve&lt;Pure.DI.Benchmarks.Model.CompositionRoot&gt;()</c>
/// </term>
/// <description>
/// Provides a composition root of type <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/>.
/// </description>
/// </item>
/// </list>
/// </para>
/// </summary>
/// <example>
/// This shows how to get an instance of type <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/> using the composition root <see cref="PureDIByCR()"/>:
/// <code>
/// var composition = new Array();
/// var instance = composition.PureDIByCR();
/// </code>
/// </example>
/// <a href="https://mermaid.live/view#pako:eNrVV0tuwjAQvYrldRfUtkTLDhIqsasoy2wMWG1aQpATIiHEHbhLN70ON2l-dj61A04ipG6swJt58zwzGTtHuPLXDI7gakODwHbpO6eew51t-huMOacH4OwHg-Ek-Td5QhPL93Z-4Iauv537fghe95zZs8nBmqf4U7o-F_ZgAeYs8DcRu5x_Fpfzt5GZv_xkqzB5xi8gpO9_3DID4Zs5LQ47BsJ4aWFtgeaQQ7tIUD0VV1KVhZu9MR65K_YIgvwhjysAJACkR5AWwTUEC6QOEAGQepgCQfq9p80Rl0rGSUoWo3J3qatdrEMrTelUhslM8BgUpBWknEkBVFNY7FqlUxgVbdwoB2nllBgUmjI0E6ZKitAYNGjE1-VhrTysU4ar2WpdcEEXIQOZSCE0J1BJjVDfYk1yilVi9XmNes8sMRBLVGKJXizpV-wNUom2V7Uyc5H6eVOdGgUDzoJbdBmEnOZze5qvDTz1VmzLU--StjykNY_qFELjcpFAdbDGhZHZNCQojcISC_rHLPK1kgU1JJDNLivZC4HyKDHehzFLPqLTAd6VqjReu1LJHJEaVfW6YdwoijtCjUOrNaa6cgfC5lXv7ikO6bv7dtHcxTc_j-7lW-qUdBpna3z4qd742Pn2zyX4AD3GPequ4y-yowPDD-YxB44cuKb8y4EnePoFSCaMCw">Class diagram</a><br/>
/// This class was created by <a href="https://github.com/DevTeam/Pure.DI">Pure.DI</a> source code generator.
/// <seealso cref="Pure.DI.DI.Setup"/>
/// <seealso cref="Pure.DI.IConfiguration.Bind(object[])"/>
/// <seealso cref="Pure.DI.IConfiguration.Bind{T}(object[])"/>
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
partial class Array
{
private readonly Array _rootM03D15di;

/// <summary>
/// This constructor creates a new instance of <see cref="Array"/>.
/// </summary>
public Array()
{
_rootM03D15di = this;
}

/// <summary>
/// This constructor creates a new instance of <see cref="Array"/> scope based on <paramref name="baseComposition"/>. This allows the <see cref="Lifetime.Scoped"/> life time to be applied.
/// </summary>
/// <param name="baseComposition">Base composition.</param>
internal Array(Array baseComposition)
{
_rootM03D15di = baseComposition._rootM03D15di;
}

#region Composition Roots
/// <summary>
/// Provides a composition root of type <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/>.
/// </summary>
/// <example>
/// This shows how to get an instance of type <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/>:
/// <code>
/// var composition = new Array();
/// var instance = composition.PureDIByCR();
/// </code>
/// </example>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public partial Pure.DI.Benchmarks.Model.CompositionRoot PureDIByCR()
{
return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Array(new Pure.DI.Benchmarks.Model.IService3[4] { new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()) })), new Pure.DI.Benchmarks.Model.Service2Array(new Pure.DI.Benchmarks.Model.IService3[4] { new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()) }), new Pure.DI.Benchmarks.Model.Service2Array(new Pure.DI.Benchmarks.Model.IService3[4] { new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()) }), new Pure.DI.Benchmarks.Model.Service2Array(new Pure.DI.Benchmarks.Model.IService3[4] { new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()) }), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4());
}
#endregion

#region API
/// <summary>
/// Resolves the composition root.
/// </summary>
/// <typeparam name="T">The type of the composition root.</typeparam>
/// <returns>A composition root.</returns>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public T Resolve<T>()
{
return ResolverM03D15di<T>.Value.Resolve(this);
}

/// <summary>
/// Resolves the composition root by tag.
/// </summary>
/// <typeparam name="T">The type of the composition root.</typeparam>
/// <param name="tag">The tag of a composition root.</param>
/// <returns>A composition root.</returns>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public T Resolve<T>(object? tag)
{
return ResolverM03D15di<T>.Value.ResolveByTag(this, tag);
}

/// <summary>
/// Resolves the composition root.
/// </summary>
/// <param name="type">The type of the composition root.</param>
/// <returns>A composition root.</returns>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public object Resolve(global::System.Type type)
{
var index = (int)(_bucketSizeM03D15di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1));
Expand All @@ -209,15 +130,6 @@ partial class Array
throw new global::System.InvalidOperationException($"Cannot resolve composition root of type {type}.");
}

/// <summary>
/// Resolves the composition root by tag.
/// </summary>
/// <param name="type">The type of the composition root.</param>
/// <param name="tag">The tag of a composition root.</param>
/// <returns>A composition root.</returns>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public object Resolve(global::System.Type type, object? tag)
{
var index = (int)(_bucketSizeM03D15di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1));
Expand All @@ -232,11 +144,7 @@ partial class Array

throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type {type}.");
}
#endregion

/// <summary>
/// This method provides a class diagram in mermaid format. To see this diagram, simply call the method and copy the text to this site https://mermaid.live/.
/// </summary>
public override string ToString()
{
return
Expand Down Expand Up @@ -332,7 +240,6 @@ partial class Array
});
}

#region Resolvers
private sealed class ResolverM03D15di<T>: global::Pure.DI.IResolver<Array, T>
{
public static global::Pure.DI.IResolver<Array, T> Value = new ResolverM03D15di<T>();
Expand Down Expand Up @@ -365,7 +272,6 @@ partial class Array
throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.Benchmarks.Model.CompositionRoot.");
}
}
#endregion
}
```

Expand Down
94 changes: 0 additions & 94 deletions readme/EnumDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,72 +86,20 @@ classDiagram
<summary>Pure.DI-generated partial class Enum</summary><blockquote>

```c#
/// <para>
/// <b>Composition roots</b><br/>
/// <list type="table">
/// <listheader>
/// <term>Root</term>
/// <description>Description</description>
/// </listheader>
/// <item>
/// <term>
/// <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/> <see cref="PureDIByCR()"/><br/>or using <see cref="Resolve{T}()"/> method: <c>Resolve&lt;Pure.DI.Benchmarks.Model.CompositionRoot&gt;()</c>
/// </term>
/// <description>
/// Provides a composition root of type <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/>.
/// </description>
/// </item>
/// </list>
/// </para>
/// </summary>
/// <example>
/// This shows how to get an instance of type <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/> using the composition root <see cref="PureDIByCR()"/>:
/// <code>
/// var composition = new Enum();
/// var instance = composition.PureDIByCR();
/// </code>
/// </example>
/// <a href="https://mermaid.live/view#pako:eNrVV0tOwzAQvYrlNQuwLRW6I0mRuqtKl9m4qQWBpK6SNBJC3IG7sOE6vQn5-NOEOK3TCImNlebNvHmemY6ddxjwDYNTGEQ0Tb2QPiU09hN_W_0Gs-0-Bv7--nrilC_LJ-S4PN7xNMxCvl1ynoHFPmHe3HlzlxV-W6132h6swJKlPMrZ4fN7dfj8sjLj6xcWZOUzfgAZffrlVhtI39pp9bZjICuWAdYu6A858XR-2qk4kao63PyRJXkYsBuQigcRVwJIAsiMICOCWwiWSBsgEiDtMBpB5r3Py-ZgCV1HZcFUtLJwhY3aY0Xg6XXiVomdqWC1Cb4HmrqBHOdTAs1E6r13qZVGqpd71SCjGk3QoagChSpjXqTMtEcmPi0RGyVikzzcTNjgyku6HFnIRB1CBUGX1ByNLdYmp7hLrDmv-eiZJRZiSZdYYhZLxhV7hlRi7FWjTCGyZ_AYxgOug7t0nWYJFQN8JtYennYrDuVpd8lQHjKYp-s4QvfHRQLN2VoURmXTkkCPwyMS9G9J1H9KVdOSQHW6KuMoBD2nifVuBnKJWV1N8nEIj6btOIQqd6RF2LyG2PZPw4A3nX24YIkT8eDVhz13IcV7zm0J2_fH5Z7yLP9z30s0X-Irjq2_8tX3zmpm12txRHaNhsL3_K8reAWLjoppuCm-3959mD2zmPlw6sMNTYqu_IAfP3i-nTA">Class diagram</a><br/>
/// This class was created by <a href="https://github.com/DevTeam/Pure.DI">Pure.DI</a> source code generator.
/// <seealso cref="Pure.DI.DI.Setup"/>
/// <seealso cref="Pure.DI.IConfiguration.Bind(object[])"/>
/// <seealso cref="Pure.DI.IConfiguration.Bind{T}(object[])"/>
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
partial class Enum
{
private readonly Enum _rootM03D15di;

/// <summary>
/// This constructor creates a new instance of <see cref="Enum"/>.
/// </summary>
public Enum()
{
_rootM03D15di = this;
}

/// <summary>
/// This constructor creates a new instance of <see cref="Enum"/> scope based on <paramref name="baseComposition"/>. This allows the <see cref="Lifetime.Scoped"/> life time to be applied.
/// </summary>
/// <param name="baseComposition">Base composition.</param>
internal Enum(Enum baseComposition)
{
_rootM03D15di = baseComposition._rootM03D15di;
}

#region Composition Roots
/// <summary>
/// Provides a composition root of type <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/>.
/// </summary>
/// <example>
/// This shows how to get an instance of type <see cref="Pure.DI.Benchmarks.Model.CompositionRoot"/>:
/// <code>
/// var composition = new Enum();
/// var instance = composition.PureDIByCR();
/// </code>
/// </example>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public partial Pure.DI.Benchmarks.Model.CompositionRoot PureDIByCR()
{
[global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)]
Expand All @@ -165,44 +113,17 @@ partial class Enum
var perBlockM03D15di10_IEnumerable = LocalperBlockM03D15di10_IEnumerable();
return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D15di10_IEnumerable)), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D15di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D15di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM03D15di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()), new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4());
}
#endregion

#region API
/// <summary>
/// Resolves the composition root.
/// </summary>
/// <typeparam name="T">The type of the composition root.</typeparam>
/// <returns>A composition root.</returns>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public T Resolve<T>()
{
return ResolverM03D15di<T>.Value.Resolve(this);
}

/// <summary>
/// Resolves the composition root by tag.
/// </summary>
/// <typeparam name="T">The type of the composition root.</typeparam>
/// <param name="tag">The tag of a composition root.</param>
/// <returns>A composition root.</returns>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public T Resolve<T>(object? tag)
{
return ResolverM03D15di<T>.Value.ResolveByTag(this, tag);
}

/// <summary>
/// Resolves the composition root.
/// </summary>
/// <param name="type">The type of the composition root.</param>
/// <returns>A composition root.</returns>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public object Resolve(global::System.Type type)
{
var index = (int)(_bucketSizeM03D15di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1));
Expand All @@ -218,15 +139,6 @@ partial class Enum
throw new global::System.InvalidOperationException($"Cannot resolve composition root of type {type}.");
}

/// <summary>
/// Resolves the composition root by tag.
/// </summary>
/// <param name="type">The type of the composition root.</param>
/// <param name="tag">The tag of a composition root.</param>
/// <returns>A composition root.</returns>
#if NETSTANDARD2_0_OR_GREATER || NETCOREAPP || NET40_OR_GREATER || NET
[global::System.Diagnostics.Contracts.Pure]
#endif
public object Resolve(global::System.Type type, object? tag)
{
var index = (int)(_bucketSizeM03D15di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1));
Expand All @@ -241,11 +153,7 @@ partial class Enum

throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type {type}.");
}
#endregion

/// <summary>
/// This method provides a class diagram in mermaid format. To see this diagram, simply call the method and copy the text to this site https://mermaid.live/.
/// </summary>
public override string ToString()
{
return
Expand Down Expand Up @@ -341,7 +249,6 @@ partial class Enum
});
}

#region Resolvers
private sealed class ResolverM03D15di<T>: global::Pure.DI.IResolver<Enum, T>
{
public static global::Pure.DI.IResolver<Enum, T> Value = new ResolverM03D15di<T>();
Expand Down Expand Up @@ -374,7 +281,6 @@ partial class Enum
throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.Benchmarks.Model.CompositionRoot.");
}
}
#endregion
}
```

Expand Down
Loading

0 comments on commit 21794f0

Please sign in to comment.