Skip to content

Commit a357d5f

Browse files
author
Nikolay Pianikov
committed
Updating internal Pure.DI to 2.4.3
1 parent 0f70360 commit a357d5f

247 files changed

Lines changed: 2147 additions & 1848 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 88 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4741,6 +4741,71 @@ To run the above code, the following NuGet packages must be added:
47414741
>[!NOTE]
47424742
>Overriding BCL bindings allows you to provide custom implementations for standard types, enabling specialized behavior for your application.
47434743
4744+
## Default BCL bindings
4745+
4746+
Pure.DI provides default bindings for commonly used .NET BCL types, so they can be injected without extra setup code.
4747+
4748+
```c#
4749+
using Shouldly;
4750+
using Pure.DI;
4751+
using System.Globalization;
4752+
using System.Security.Cryptography;
4753+
4754+
DI.Setup(nameof(Composition))
4755+
.Root<ReportService>("ReportService");
4756+
4757+
var composition = new Composition();
4758+
var reportService = composition.ReportService;
4759+
4760+
reportService.Culture.ShouldBe(CultureInfo.CurrentCulture);
4761+
reportService.FormatProvider.ShouldBe(reportService.Culture);
4762+
reportService.CompareInfo.ShouldBe(CultureInfo.CurrentCulture.CompareInfo);
4763+
reportService.StringComparer.ShouldBe(StringComparer.Ordinal);
4764+
reportService.StringComparison.ShouldBe(StringComparison.Ordinal);
4765+
reportService.TimeProvider.ShouldBe(TimeProvider.System);
4766+
reportService.Completion.Task.CreationOptions
4767+
.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously)
4768+
.ShouldBeTrue();
4769+
4770+
var bytes = new byte[4];
4771+
reportService.RandomNumberGenerator.GetBytes(bytes);
4772+
bytes.Length.ShouldBe(4);
4773+
4774+
class ReportService(
4775+
CultureInfo culture,
4776+
IFormatProvider formatProvider,
4777+
CompareInfo compareInfo,
4778+
StringComparer stringComparer,
4779+
StringComparison stringComparison,
4780+
TimeProvider timeProvider,
4781+
TaskCompletionSource<string> completion,
4782+
RandomNumberGenerator randomNumberGenerator)
4783+
{
4784+
public CultureInfo Culture { get; } = culture;
4785+
4786+
public IFormatProvider FormatProvider { get; } = formatProvider;
4787+
4788+
public CompareInfo CompareInfo { get; } = compareInfo;
4789+
4790+
public StringComparer StringComparer { get; } = stringComparer;
4791+
4792+
public StringComparison StringComparison { get; } = stringComparison;
4793+
4794+
public TimeProvider TimeProvider { get; } = timeProvider;
4795+
4796+
public TaskCompletionSource<string> Completion { get; } = completion;
4797+
4798+
public RandomNumberGenerator RandomNumberGenerator { get; } = randomNumberGenerator;
4799+
}
4800+
```
4801+
4802+
To run the above code, the following NuGet packages must be added:
4803+
- [Pure.DI](https://www.nuget.org/packages/Pure.DI)
4804+
- [Shouldly](https://www.nuget.org/packages/Shouldly)
4805+
4806+
>[!NOTE]
4807+
>Default BCL bindings can still be overridden in the composition when an application needs a different policy.
4808+
47444809
## Generics
47454810

47464811
Generic types are also supported.
@@ -11245,7 +11310,7 @@ The [project file](/samples/AvaloniaApp/AvaloniaApp.csproj) looks like this:
1124511310
<Project Sdk="Microsoft.NET.Sdk">
1124611311
...
1124711312
<ItemGroup>
11248-
<PackageReference Include="Pure.DI" Version="2.4.2">
11313+
<PackageReference Include="Pure.DI" Version="2.4.3">
1124911314
<PrivateAssets>all</PrivateAssets>
1125011315
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1125111316
</PackageReference>
@@ -11316,11 +11381,11 @@ The [project file](/samples/BlazorServerApp/BlazorServerApp.csproj) looks like t
1131611381
<Project Sdk="Microsoft.NET.Sdk.Web">
1131711382
...
1131811383
<ItemGroup>
11319-
<PackageReference Include="Pure.DI" Version="2.4.2">
11384+
<PackageReference Include="Pure.DI" Version="2.4.3">
1132011385
<PrivateAssets>all</PrivateAssets>
1132111386
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1132211387
</PackageReference>
11323-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
11388+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
1132411389
</ItemGroup>
1132511390

1132611391
</Project>
@@ -11398,11 +11463,11 @@ The [project file](/samples/BlazorWebAssemblyApp/BlazorWebAssemblyApp.csproj) lo
1139811463
<Project Sdk="Microsoft.NET.Sdk.Web">
1139911464
...
1140011465
<ItemGroup>
11401-
<PackageReference Include="Pure.DI" Version="2.4.2">
11466+
<PackageReference Include="Pure.DI" Version="2.4.3">
1140211467
<PrivateAssets>all</PrivateAssets>
1140311468
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1140411469
</PackageReference>
11405-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
11470+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
1140611471
</ItemGroup>
1140711472

1140811473
</Project>
@@ -11496,7 +11561,7 @@ The [project file](/samples/ShroedingersCatNativeAOT/ShroedingersCatNativeAOT.cs
1149611561
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1149711562
</PropertyGroup>
1149811563
<ItemGroup>
11499-
<PackageReference Include="Pure.DI" Version="2.4.2">
11564+
<PackageReference Include="Pure.DI" Version="2.4.3">
1150011565
<PrivateAssets>all</PrivateAssets>
1150111566
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1150211567
</PackageReference>
@@ -11599,7 +11664,7 @@ The [project file](/samples/ShroedingersCat/ShroedingersCat.csproj) looks like t
1159911664
<Project Sdk="Microsoft.NET.Sdk">
1160011665
...
1160111666
<ItemGroup>
11602-
<PackageReference Include="Pure.DI" Version="2.4.2">
11667+
<PackageReference Include="Pure.DI" Version="2.4.3">
1160311668
<PrivateAssets>all</PrivateAssets>
1160411669
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1160511670
</PackageReference>
@@ -11688,7 +11753,7 @@ The [project file](/samples/ShroedingersCatTopLevelStatements/ShroedingersCatTop
1168811753
<Project Sdk="Microsoft.NET.Sdk">
1168911754
...
1169011755
<ItemGroup>
11691-
<PackageReference Include="Pure.DI" Version="2.4.2">
11756+
<PackageReference Include="Pure.DI" Version="2.4.3">
1169211757
<PrivateAssets>all</PrivateAssets>
1169311758
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1169411759
</PackageReference>
@@ -11796,11 +11861,11 @@ The [project file](/samples/EF/EF.csproj) looks like this:
1179611861
<Project Sdk="Microsoft.NET.Sdk">
1179711862
...
1179811863
<ItemGroup>
11799-
<PackageReference Include="Pure.DI" Version="2.4.2">
11864+
<PackageReference Include="Pure.DI" Version="2.4.3">
1180011865
<PrivateAssets>all</PrivateAssets>
1180111866
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1180211867
</PackageReference>
11803-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
11868+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
1180411869
</ItemGroup>
1180511870

1180611871
</Project>
@@ -11871,11 +11936,11 @@ The [project file](/samples/GrpcService/GrpcService.csproj) looks like this:
1187111936
<Project Sdk="Microsoft.NET.Sdk.Web">
1187211937
...
1187311938
<ItemGroup>
11874-
<PackageReference Include="Pure.DI" Version="2.4.2">
11939+
<PackageReference Include="Pure.DI" Version="2.4.3">
1187511940
<PrivateAssets>all</PrivateAssets>
1187611941
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1187711942
</PackageReference>
11878-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
11943+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
1187911944
</ItemGroup>
1188011945

1188111946
</Project>
@@ -12042,11 +12107,11 @@ The [project file](/samples/MAUIApp/MAUIApp.csproj) looks like this:
1204212107
<Project Sdk="Microsoft.NET.Sdk">
1204312108
...
1204412109
<ItemGroup>
12045-
<PackageReference Include="Pure.DI" Version="2.4.2">
12110+
<PackageReference Include="Pure.DI" Version="2.4.3">
1204612111
<PrivateAssets>all</PrivateAssets>
1204712112
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1204812113
</PackageReference>
12049-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
12114+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
1205012115
</ItemGroup>
1205112116

1205212117
</Project>
@@ -12142,11 +12207,11 @@ The [project file](/samples/MinimalWebAPI/MinimalWebAPI.csproj) looks like this:
1214212207
<Project Sdk="Microsoft.NET.Sdk.Web">
1214312208
...
1214412209
<ItemGroup>
12145-
<PackageReference Include="Pure.DI" Version="2.4.2">
12210+
<PackageReference Include="Pure.DI" Version="2.4.3">
1214612211
<PrivateAssets>all</PrivateAssets>
1214712212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1214812213
</PackageReference>
12149-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
12214+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
1215012215
</ItemGroup>
1215112216

1215212217
</Project>
@@ -12353,11 +12418,11 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this:
1235312418
<Project Sdk="Microsoft.NET.Sdk.Web">
1235412419
...
1235512420
<ItemGroup>
12356-
<PackageReference Include="Pure.DI" Version="2.4.2">
12421+
<PackageReference Include="Pure.DI" Version="2.4.3">
1235712422
<PrivateAssets>all</PrivateAssets>
1235812423
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1235912424
</PackageReference>
12360-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
12425+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
1236112426
</ItemGroup>
1236212427

1236312428
</Project>
@@ -12429,11 +12494,11 @@ The [project file](/samples/WebApp/WebApp.csproj) looks like this:
1242912494
<Project Sdk="Microsoft.NET.Sdk.Web">
1243012495
...
1243112496
<ItemGroup>
12432-
<PackageReference Include="Pure.DI" Version="2.4.2">
12497+
<PackageReference Include="Pure.DI" Version="2.4.3">
1243312498
<PrivateAssets>all</PrivateAssets>
1243412499
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1243512500
</PackageReference>
12436-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
12501+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
1243712502
</ItemGroup>
1243812503

1243912504
</Project>
@@ -12509,7 +12574,7 @@ The [project file](/samples/WinFormsAppNetCore/WinFormsAppNetCore.csproj) looks
1250912574
<Project Sdk="Microsoft.NET.Sdk">
1251012575
...
1251112576
<ItemGroup>
12512-
<PackageReference Include="Pure.DI" Version="2.4.2">
12577+
<PackageReference Include="Pure.DI" Version="2.4.3">
1251312578
<PrivateAssets>all</PrivateAssets>
1251412579
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1251512580
</PackageReference>
@@ -12590,7 +12655,7 @@ The [project file](/samples/WinFormsApp/WinFormsApp.csproj) looks like this:
1259012655
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1259112656
...
1259212657
<ItemGroup>
12593-
<PackageReference Include="Pure.DI" Version="2.4.2">
12658+
<PackageReference Include="Pure.DI" Version="2.4.3">
1259412659
<PrivateAssets>all</PrivateAssets>
1259512660
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1259612661
</PackageReference>
@@ -12709,7 +12774,7 @@ The [project file](/samples/WpfAppNetCore/WpfAppNetCore.csproj) looks like this:
1270912774
<Project Sdk="Microsoft.NET.Sdk">
1271012775
...
1271112776
<ItemGroup>
12712-
<PackageReference Include="Pure.DI" Version="2.4.2">
12777+
<PackageReference Include="Pure.DI" Version="2.4.3">
1271312778
<PrivateAssets>all</PrivateAssets>
1271412779
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1271512780
</PackageReference>

CONTRIBUTING.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ or to run benchmarks:
7272
./build.cmd benchmarks
7373
```
7474

75-
To install project templates locally, use the build target so template package versions are resolved from `Directory.Build.props`:
76-
77-
```shell
78-
./build.cmd install
79-
```
80-
8175
If you are using the Rider IDE, it already has a set of configurations to run these commands. This project uses [C# interactive](https://github.com/DevTeam/csharp-interactive) build automation system for .NET. This tool helps to make .NET builds more efficient.
8276

8377
![](https://raw.githubusercontent.com/DevTeam/csharp-interactive/master/docs/CSharpInteractive.gif)

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<VersionRange>2.4.*</VersionRange>
5-
<InternalVersion>2.4.2</InternalVersion>
5+
<InternalVersion>2.4.3</InternalVersion>
66
<BasePackageId>Pure.DI</BasePackageId>
77
<LangVersion>latest</LangVersion>
88
<!--Make sure that Build.Settings.BaseDotNetFrameworkMajorVersion has been updated.-->

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ dotnet run
353353
- [Service provider](readme/service-provider.md)
354354
- [Service provider with scope](readme/service-provider-with-scope.md)
355355
- [Overriding the BCL binding](readme/overriding-the-bcl-binding.md)
356+
- [Default BCL bindings](readme/default-bcl-bindings.md)
356357
### Generics
357358
- [Generics](readme/generics.md)
358359
- [Generic composition roots](readme/generic-composition-roots.md)
@@ -2407,7 +2408,7 @@ AI needs to understand the situation it’s in (context). This means knowing det
24072408
| --------------- | ---- | ------ |
24082409
| [AGENTS_SMALL.md](AGENTS_SMALL.md) | 62KB | 16K |
24092410
| [AGENTS_MEDIUM.md](AGENTS_MEDIUM.md) | 112KB | 28K |
2410-
| [AGENTS.md](AGENTS.md) | 411KB | 105K |
2411+
| [AGENTS.md](AGENTS.md) | 413KB | 105K |
24112412

24122413
For different IDEs, you can use the _AGENTS.md_ file as is by simply copying it to the root directory. For use with _JetBrains Rider_ and _Junie_, please refer to [these instructions](https://www.jetbrains.com/help/junie/customize-guidelines.html). For example, you can copy any _AGENTS.md_ file into your project (using _Pure.DI_) as _.junie/guidelines.md._
24132414
## How to contribute to Pure.DI

readme/Avalonia.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ The [project file](/samples/AvaloniaApp/AvaloniaApp.csproj) looks like this:
167167
<Project Sdk="Microsoft.NET.Sdk">
168168
...
169169
<ItemGroup>
170-
<PackageReference Include="Pure.DI" Version="2.4.2">
170+
<PackageReference Include="Pure.DI" Version="2.4.3">
171171
<PrivateAssets>all</PrivateAssets>
172172
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
173173
</PackageReference>

readme/BlazorServerApp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ The [project file](/samples/BlazorServerApp/BlazorServerApp.csproj) looks like t
5454
<Project Sdk="Microsoft.NET.Sdk.Web">
5555
...
5656
<ItemGroup>
57-
<PackageReference Include="Pure.DI" Version="2.4.2">
57+
<PackageReference Include="Pure.DI" Version="2.4.3">
5858
<PrivateAssets>all</PrivateAssets>
5959
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6060
</PackageReference>
61-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
61+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
6262
</ItemGroup>
6363

6464
</Project>

readme/BlazorWebAssemblyApp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ The [project file](/samples/BlazorWebAssemblyApp/BlazorWebAssemblyApp.csproj) lo
6363
<Project Sdk="Microsoft.NET.Sdk.Web">
6464
...
6565
<ItemGroup>
66-
<PackageReference Include="Pure.DI" Version="2.4.2">
66+
<PackageReference Include="Pure.DI" Version="2.4.3">
6767
<PrivateAssets>all</PrivateAssets>
6868
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6969
</PackageReference>
70-
<PackageReference Include="Pure.DI.MS" Version="2.4.2" />
70+
<PackageReference Include="Pure.DI.MS" Version="2.4.3" />
7171
</ItemGroup>
7272

7373
</Project>

readme/Console.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The [project file](/samples/ShroedingersCat/ShroedingersCat.csproj) looks like t
8686
<Project Sdk="Microsoft.NET.Sdk">
8787
...
8888
<ItemGroup>
89-
<PackageReference Include="Pure.DI" Version="2.4.2">
89+
<PackageReference Include="Pure.DI" Version="2.4.3">
9090
<PrivateAssets>all</PrivateAssets>
9191
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
9292
</PackageReference>

readme/ConsoleNativeAOT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The [project file](/samples/ShroedingersCatNativeAOT/ShroedingersCatNativeAOT.cs
7979
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
8080
</PropertyGroup>
8181
<ItemGroup>
82-
<PackageReference Include="Pure.DI" Version="2.4.2">
82+
<PackageReference Include="Pure.DI" Version="2.4.3">
8383
<PrivateAssets>all</PrivateAssets>
8484
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8585
</PackageReference>

readme/ConsoleTopLevelStatements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ The [project file](/samples/ShroedingersCatTopLevelStatements/ShroedingersCatTop
7272
<Project Sdk="Microsoft.NET.Sdk">
7373
...
7474
<ItemGroup>
75-
<PackageReference Include="Pure.DI" Version="2.4.2">
75+
<PackageReference Include="Pure.DI" Version="2.4.3">
7676
<PrivateAssets>all</PrivateAssets>
7777
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7878
</PackageReference>

0 commit comments

Comments
 (0)