diff --git a/README.md b/README.md index 33d8b2e4f..34ff6f754 100644 --- a/README.md +++ b/README.md @@ -937,14 +937,14 @@ Installed [.NET SDK 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) - - - - - - - - + + + + + + + +
Method Mean ErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Hand Coded'181.4 ns3.65 ns6.09 ns1.000.000.0365-632 B1.00
'Pure.DI composition root'182.0 ns3.57 ns7.29 ns1.010.040.0365-632 B1.00
'Pure.DI Resolve<T>()'186.1 ns3.52 ns4.58 ns1.030.040.0365-632 B1.00
'Pure.DI Resolve(Type)'189.8 ns3.90 ns11.05 ns1.080.070.0365-632 B1.00
LightInject198.9 ns4.06 ns8.01 ns1.100.050.0365-632 B1.00
DryIoc213.3 ns4.35 ns10.82 ns1.200.070.0365-632 B1.00
Unity10,172.3 ns193.16 ns180.68 ns55.871.970.8392-14520 B22.97
Autofac27,444.9 ns318.63 ns248.76 ns149.083.871.64790.061028816 B45.59
'Hand Coded'168.1 ns1.72 ns1.44 ns1.000.000.0336-632 B1.00
'Pure.DI composition root'169.6 ns3.08 ns2.58 ns1.010.020.0336-632 B1.00
'Pure.DI Resolve<T>()'170.7 ns3.02 ns2.52 ns1.020.020.0336-632 B1.00
'Pure.DI Resolve(Type)'171.2 ns2.44 ns2.04 ns1.020.020.0336-632 B1.00
LightInject179.8 ns3.43 ns3.21 ns1.070.020.0336-632 B1.00
DryIoc200.5 ns3.89 ns4.16 ns1.200.020.0336-632 B1.00
Unity9,966.0 ns80.16 ns62.58 ns59.260.420.7629-14520 B22.97
Autofac27,170.5 ns308.31 ns257.45 ns161.601.871.52590.061028816 B45.59
[Array details](readme/ArrayDetails.md) @@ -957,15 +957,15 @@ Installed [.NET SDK 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) - - - - - - - - - + + + + + + + + +
Method Mean ErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Pure.DI Resolve<T>()'136.3 ns2.77 ns4.48 ns0.880.030.0198-344 B1.00
'Pure.DI Resolve(Type)'137.9 ns2.84 ns4.66 ns0.880.030.0198-344 B1.00
'Pure.DI composition root'141.5 ns2.69 ns5.50 ns0.920.050.0198-344 B1.00
'Hand Coded'157.7 ns3.24 ns3.32 ns1.000.000.0198-344 B1.00
'Microsoft DI'189.1 ns3.11 ns2.60 ns1.200.020.0272-472 B1.37
LightInject290.2 ns5.79 ns5.42 ns1.840.050.0496-856 B2.49
DryIoc308.8 ns6.25 ns14.12 ns1.920.080.0496-856 B2.49
Unity7,874.1 ns137.31 ns128.44 ns50.051.180.7935-13752 B39.98
Autofac26,601.4 ns213.84 ns189.56 ns168.634.201.64790.061028944 B84.14
'Pure.DI composition root'128.2 ns1.50 ns1.25 ns0.910.010.0184-344 B1.00
'Pure.DI Resolve(Type)'130.5 ns2.22 ns1.85 ns0.930.020.0184-344 B1.00
'Pure.DI Resolve<T>()'133.8 ns2.38 ns1.99 ns0.950.010.0184-344 B1.00
'Hand Coded'140.3 ns1.69 ns1.41 ns1.000.000.0184-344 B1.00
'Microsoft DI'181.3 ns2.01 ns1.67 ns1.290.020.0250-472 B1.37
LightInject277.7 ns3.47 ns2.89 ns1.980.030.0458-856 B2.49
DryIoc281.7 ns5.33 ns4.45 ns2.010.030.0458-856 B2.49
Unity7,768.1 ns124.10 ns152.41 ns55.431.240.7324-13752 B39.98
Autofac26,954.8 ns529.73 ns543.99 ns192.634.871.52590.061028944 B84.14
[Enum details](readme/EnumDetails.md) @@ -978,14 +978,14 @@ Installed [.NET SDK 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) - - - - - - - - + + + + + + + +
Method Mean ErrorStdDevRatioRatioSDGen0AllocatedAlloc Ratio
'Hand Coded'9.394 ns0.2654 ns0.3056 ns1.000.000.001424 B1.00
'Pure.DI composition root'9.462 ns0.2354 ns0.2087 ns1.000.040.001424 B1.00
'Pure.DI Resolve<T>()'12.645 ns0.2946 ns0.2756 ns1.340.050.001424 B1.00
'Pure.DI Resolve(Type)'13.081 ns0.1891 ns0.1676 ns1.380.040.001424 B1.00
DryIoc70.358 ns1.4444 ns1.2804 ns7.410.270.0069120 B5.00
LightInject328.676 ns5.6607 ns4.7269 ns34.520.990.0291504 B21.00
Unity4,550.994 ns30.3968 ns26.9460 ns479.3813.310.14502552 B106.33
Autofac11,121.527 ns148.2118 ns138.6374 ns1,174.5728.550.808714008 B583.67
'Pure.DI composition root'8.002 ns0.1496 ns0.1326 ns0.850.010.001324 B1.00
'Hand Coded'9.445 ns0.1727 ns0.1615 ns1.000.000.001324 B1.00
'Pure.DI Resolve<T>()'10.327 ns0.2801 ns0.2620 ns1.090.020.001324 B1.00
'Pure.DI Resolve(Type)'11.954 ns0.2458 ns0.2053 ns1.260.030.001324 B1.00
DryIoc62.785 ns1.1086 ns0.9828 ns6.650.190.0063120 B5.00
LightInject296.638 ns3.9363 ns3.2870 ns31.370.800.0267504 B21.00
Unity4,448.473 ns35.3598 ns33.0756 ns471.119.330.12972552 B106.33
Autofac10,857.806 ns115.9508 ns96.8241 ns1,147.9522.400.747714008 B583.67
[Func details](readme/FuncDetails.md) @@ -998,18 +998,18 @@ Installed [.NET SDK 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) - - - - - - - - - - - - + + + + + + + + + + + +
Method Mean Error StdDev RatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Hand Coded'8.469 ns0.2493 ns0.4165 ns1.000.000.0014-24 B1.00
'Pure.DI composition root'9.506 ns0.2733 ns0.3648 ns1.110.060.0014-24 B1.00
'Pure.DI Resolve<T>()'12.508 ns0.2986 ns0.2793 ns1.430.080.0014-24 B1.00
'Pure.DI Resolve(Type)'12.572 ns0.2674 ns0.2501 ns1.430.070.0014-24 B1.00
DryIoc28.755 ns0.2372 ns0.2219 ns3.280.150.0014-24 B1.00
'Simple Injector'35.304 ns0.2639 ns0.2060 ns3.990.190.0014-24 B1.00
'Microsoft DI'39.436 ns0.4113 ns0.3435 ns4.480.240.0014-24 B1.00
LightInject910.508 ns5.9297 ns5.2565 ns103.564.970.0010-24 B1.00
Unity7,927.580 ns29.0347 ns24.2453 ns900.8144.060.1831-3184 B132.67
Autofac19,562.149 ns236.3915 ns209.5549 ns2,224.3694.371.37330.030524208 B1,008.67
'Castle Windsor'31,009.123 ns327.3126 ns306.1684 ns3,531.38141.291.3428-23912 B996.33
Ninject120,850.129 ns2,359.7906 ns3,532.0234 ns14,228.15605.724.27251.098674096 B3,087.33
'Hand Coded'7.600 ns0.1685 ns0.1316 ns1.000.000.0013-24 B1.00
'Pure.DI composition root'8.652 ns0.2436 ns0.2392 ns1.140.030.0013-24 B1.00
'Pure.DI Resolve<T>()'9.919 ns0.2579 ns0.2154 ns1.300.040.0013-24 B1.00
'Pure.DI Resolve(Type)'11.393 ns0.2199 ns0.1836 ns1.500.040.0013-24 B1.00
DryIoc27.581 ns0.3758 ns0.3138 ns3.630.070.0013-24 B1.00
'Simple Injector'33.807 ns0.3441 ns0.3050 ns4.450.100.0013-24 B1.00
'Microsoft DI'38.478 ns0.3053 ns0.2549 ns5.060.070.0013-24 B1.00
LightInject865.775 ns1.2567 ns1.0494 ns113.961.960.0010-24 B1.00
Unity7,677.459 ns99.8336 ns88.4999 ns1,011.6717.400.1678-3184 B132.67
Autofac18,825.341 ns315.1815 ns263.1908 ns2,478.0062.671.28170.030524208 B1,008.67
'Castle Windsor'31,318.225 ns408.7010 ns362.3028 ns4,123.5674.241.2207-23912 B996.33
Ninject116,099.082 ns2,240.6371 ns2,991.1861 ns15,609.54360.853.90630.976674096 B3,087.33
[Singleton details](readme/SingletonDetails.md) @@ -1022,18 +1022,18 @@ Installed [.NET SDK 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) - - - - - - - - - - - - + + + + + + + + + + + +
Method Mean Error StdDev RatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Hand Coded'8.300 ns0.2275 ns0.2017 ns1.000.000.0014-24 B1.00
'Pure.DI composition root'8.417 ns0.2472 ns0.2313 ns1.020.040.0014-24 B1.00
'Pure.DI Resolve<T>()'10.007 ns0.2170 ns0.1924 ns1.210.030.0014-24 B1.00
'Pure.DI Resolve(Type)'10.739 ns0.2942 ns0.4915 ns1.290.060.0014-24 B1.00
LightInject18.968 ns0.4292 ns0.3805 ns2.290.070.0014-24 B1.00
'Microsoft DI'24.761 ns0.2356 ns0.2089 ns2.980.070.0014-24 B1.00
DryIoc26.034 ns0.3170 ns0.2810 ns3.140.060.0014-24 B1.00
'Simple Injector'33.862 ns0.4485 ns0.3976 ns4.080.110.0014-24 B1.00
Unity11,055.904 ns85.9931 ns76.2306 ns1,332.6531.500.2899-5176 B215.67
Autofac28,686.734 ns523.7684 ns464.3070 ns3,458.02103.751.92260.091633224 B1,384.33
'Castle Windsor'57,113.574 ns417.0749 ns369.7260 ns6,883.84138.263.1128-54360 B2,265.00
Ninject259,310.814 ns5,082.3164 ns5,438.0217 ns31,238.771,101.537.32421.9531131008 B5,458.67
'Pure.DI composition root'7.903 ns0.1254 ns0.0979 ns0.970.020.0013-24 B1.00
'Hand Coded'8.135 ns0.1484 ns0.1158 ns1.000.000.0013-24 B1.00
'Pure.DI Resolve<T>()'10.337 ns0.2882 ns0.3848 ns1.280.040.0013-24 B1.00
'Pure.DI Resolve(Type)'11.442 ns0.2251 ns0.1995 ns1.410.030.0013-24 B1.00
LightInject20.096 ns0.0607 ns0.0507 ns2.470.040.0013-24 B1.00
'Microsoft DI'25.671 ns0.1087 ns0.0849 ns3.160.050.0013-24 B1.00
DryIoc27.474 ns0.5736 ns0.4478 ns3.380.070.0013-24 B1.00
'Simple Injector'34.814 ns0.2384 ns0.2114 ns4.280.050.0013-24 B1.00
Unity11,090.606 ns65.9897 ns61.7268 ns1,366.0819.490.2747-5176 B215.67
Autofac28,646.903 ns355.7947 ns315.4027 ns3,520.2461.911.77000.091633224 B1,384.33
'Castle Windsor'58,534.573 ns988.3103 ns876.1114 ns7,196.49162.412.8687-54360 B2,265.00
Ninject253,820.129 ns4,777.4163 ns5,310.0855 ns31,080.38673.816.83591.4648131008 B5,458.67
[Transient details](readme/TransientDetails.md) @@ -1045,7 +1045,7 @@ Installed [.NET SDK 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)

 BenchmarkDotNet v0.13.12, Ubuntu 20.04.6 LTS (Focal Fossa)
-Intel Xeon Platinum 8175M CPU 2.50GHz, 1 CPU, 2 logical cores and 1 physical core
+Intel Xeon Platinum 8259CL CPU 2.50GHz, 1 CPU, 2 logical cores and 1 physical core
 .NET SDK 8.0.201
   [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
   DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
diff --git a/benchmarks/data/Enum.html b/benchmarks/data/Enum.html
deleted file mode 100644
index 19539d11c..000000000
--- a/benchmarks/data/Enum.html
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-Pure.DI.Benchmarks.Benchmarks.Enum-20240413-090302
-
-
-
-
-

-BenchmarkDotNet v0.13.12, Ubuntu 20.04.6 LTS (Focal Fossa)
-Intel Xeon Platinum 8175M CPU 2.50GHz, 1 CPU, 2 logical cores and 1 physical core
-.NET SDK 8.0.201
-  [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
-  DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
-
-
- - - - - - - - - - - - - - - - -
Method Mean ErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Simple Injector'NANANA??NANANA?
'Castle Windsor'NANANA??NANANA?
NinjectNANANA??NANANA?
'Pure.DI Resolve<T>()'136.3 ns2.77 ns4.48 ns0.880.030.0198-344 B1.00
'Pure.DI Resolve(Type)'137.9 ns2.84 ns4.66 ns0.880.030.0198-344 B1.00
'Pure.DI composition root'141.5 ns2.69 ns5.50 ns0.920.050.0198-344 B1.00
'Hand Coded'157.7 ns3.24 ns3.32 ns1.000.000.0198-344 B1.00
'Microsoft DI'189.1 ns3.11 ns2.60 ns1.200.020.0272-472 B1.37
LightInject290.2 ns5.79 ns5.42 ns1.840.050.0496-856 B2.49
DryIoc308.8 ns6.25 ns14.12 ns1.920.080.0496-856 B2.49
Unity7,874.1 ns137.31 ns128.44 ns50.051.180.7935-13752 B39.98
Autofac26,601.4 ns213.84 ns189.56 ns168.634.201.64790.061028944 B84.14
- - diff --git a/benchmarks/data/Array.html b/benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Array-report.html similarity index 54% rename from benchmarks/data/Array.html rename to benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Array-report.html index 09904c49a..4c103345d 100644 --- a/benchmarks/data/Array.html +++ b/benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Array-report.html @@ -2,7 +2,7 @@ -Pure.DI.Benchmarks.Benchmarks.Array-20240413-085624 +Pure.DI.Benchmarks.Benchmarks.Array-20240420-074640 + + +

+BenchmarkDotNet v0.13.12, Ubuntu 20.04.6 LTS (Focal Fossa)
+Intel Xeon Platinum 8259CL CPU 2.50GHz, 1 CPU, 2 logical cores and 1 physical core
+.NET SDK 8.0.201
+  [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
+  DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
+
+
+ + + + + + + + + + + + + + + + +
Method Mean ErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Simple Injector'NANANA??NANANA?
'Castle Windsor'NANANA??NANANA?
NinjectNANANA??NANANA?
'Pure.DI composition root'128.2 ns1.50 ns1.25 ns0.910.010.0184-344 B1.00
'Pure.DI Resolve(Type)'130.5 ns2.22 ns1.85 ns0.930.020.0184-344 B1.00
'Pure.DI Resolve<T>()'133.8 ns2.38 ns1.99 ns0.950.010.0184-344 B1.00
'Hand Coded'140.3 ns1.69 ns1.41 ns1.000.000.0184-344 B1.00
'Microsoft DI'181.3 ns2.01 ns1.67 ns1.290.020.0250-472 B1.37
LightInject277.7 ns3.47 ns2.89 ns1.980.030.0458-856 B2.49
DryIoc281.7 ns5.33 ns4.45 ns2.010.030.0458-856 B2.49
Unity7,768.1 ns124.10 ns152.41 ns55.431.240.7324-13752 B39.98
Autofac26,954.8 ns529.73 ns543.99 ns192.634.871.52590.061028944 B84.14
+ + diff --git a/benchmarks/data/Func.html b/benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Func-report.html similarity index 51% rename from benchmarks/data/Func.html rename to benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Func-report.html index 5f40c31fd..929357825 100644 --- a/benchmarks/data/Func.html +++ b/benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Func-report.html @@ -2,7 +2,7 @@ -Pure.DI.Benchmarks.Benchmarks.Func-20240413-090718 +Pure.DI.Benchmarks.Benchmarks.Func-20240420-075230 + + +

+BenchmarkDotNet v0.13.12, Ubuntu 20.04.6 LTS (Focal Fossa)
+Intel Xeon Platinum 8259CL CPU 2.50GHz, 1 CPU, 2 logical cores and 1 physical core
+.NET SDK 8.0.201
+  [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
+  DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
+
+
+ + + + + + + + + + + + + + + + +
Method Mean Error StdDev RatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Hand Coded'7.600 ns0.1685 ns0.1316 ns1.000.000.0013-24 B1.00
'Pure.DI composition root'8.652 ns0.2436 ns0.2392 ns1.140.030.0013-24 B1.00
'Pure.DI Resolve<T>()'9.919 ns0.2579 ns0.2154 ns1.300.040.0013-24 B1.00
'Pure.DI Resolve(Type)'11.393 ns0.2199 ns0.1836 ns1.500.040.0013-24 B1.00
DryIoc27.581 ns0.3758 ns0.3138 ns3.630.070.0013-24 B1.00
'Simple Injector'33.807 ns0.3441 ns0.3050 ns4.450.100.0013-24 B1.00
'Microsoft DI'38.478 ns0.3053 ns0.2549 ns5.060.070.0013-24 B1.00
LightInject865.775 ns1.2567 ns1.0494 ns113.961.960.0010-24 B1.00
Unity7,677.459 ns99.8336 ns88.4999 ns1,011.6717.400.1678-3184 B132.67
Autofac18,825.341 ns315.1815 ns263.1908 ns2,478.0062.671.28170.030524208 B1,008.67
'Castle Windsor'31,318.225 ns408.7010 ns362.3028 ns4,123.5674.241.2207-23912 B996.33
Ninject116,099.082 ns2,240.6371 ns2,991.1861 ns15,609.54360.853.90630.976674096 B3,087.33
+ + diff --git a/benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Transient-report.html b/benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Transient-report.html new file mode 100644 index 000000000..2c0cd9a8e --- /dev/null +++ b/benchmarks/data/Pure.DI.Benchmarks.Benchmarks.Transient-report.html @@ -0,0 +1,41 @@ + + + + +Pure.DI.Benchmarks.Benchmarks.Transient-20240420-080021 + + + + +

+BenchmarkDotNet v0.13.12, Ubuntu 20.04.6 LTS (Focal Fossa)
+Intel Xeon Platinum 8259CL CPU 2.50GHz, 1 CPU, 2 logical cores and 1 physical core
+.NET SDK 8.0.201
+  [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
+  DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
+
+
+ + + + + + + + + + + + + + + + +
Method Mean Error StdDev RatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Pure.DI composition root'7.903 ns0.1254 ns0.0979 ns0.970.020.0013-24 B1.00
'Hand Coded'8.135 ns0.1484 ns0.1158 ns1.000.000.0013-24 B1.00
'Pure.DI Resolve<T>()'10.337 ns0.2882 ns0.3848 ns1.280.040.0013-24 B1.00
'Pure.DI Resolve(Type)'11.442 ns0.2251 ns0.1995 ns1.410.030.0013-24 B1.00
LightInject20.096 ns0.0607 ns0.0507 ns2.470.040.0013-24 B1.00
'Microsoft DI'25.671 ns0.1087 ns0.0849 ns3.160.050.0013-24 B1.00
DryIoc27.474 ns0.5736 ns0.4478 ns3.380.070.0013-24 B1.00
'Simple Injector'34.814 ns0.2384 ns0.2114 ns4.280.050.0013-24 B1.00
Unity11,090.606 ns65.9897 ns61.7268 ns1,366.0819.490.2747-5176 B215.67
Autofac28,646.903 ns355.7947 ns315.4027 ns3,520.2461.911.77000.091633224 B1,384.33
'Castle Windsor'58,534.573 ns988.3103 ns876.1114 ns7,196.49162.412.8687-54360 B2,265.00
Ninject253,820.129 ns4,777.4163 ns5,310.0855 ns31,080.38673.816.83591.4648131008 B5,458.67
+ + diff --git a/benchmarks/data/Singleton.html b/benchmarks/data/Singleton.html deleted file mode 100644 index e8ba45f72..000000000 --- a/benchmarks/data/Singleton.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - -Pure.DI.Benchmarks.Benchmarks.Singleton-20240413-091023 - - - - -

-BenchmarkDotNet v0.13.12, Ubuntu 20.04.6 LTS (Focal Fossa)
-Intel Xeon Platinum 8175M CPU 2.50GHz, 1 CPU, 2 logical cores and 1 physical core
-.NET SDK 8.0.201
-  [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
-  DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
-
-
- - - - - - - - - - - - - - - - -
Method Mean Error StdDev RatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Hand Coded'8.469 ns0.2493 ns0.4165 ns1.000.000.0014-24 B1.00
'Pure.DI composition root'9.506 ns0.2733 ns0.3648 ns1.110.060.0014-24 B1.00
'Pure.DI Resolve<T>()'12.508 ns0.2986 ns0.2793 ns1.430.080.0014-24 B1.00
'Pure.DI Resolve(Type)'12.572 ns0.2674 ns0.2501 ns1.430.070.0014-24 B1.00
DryIoc28.755 ns0.2372 ns0.2219 ns3.280.150.0014-24 B1.00
'Simple Injector'35.304 ns0.2639 ns0.2060 ns3.990.190.0014-24 B1.00
'Microsoft DI'39.436 ns0.4113 ns0.3435 ns4.480.240.0014-24 B1.00
LightInject910.508 ns5.9297 ns5.2565 ns103.564.970.0010-24 B1.00
Unity7,927.580 ns29.0347 ns24.2453 ns900.8144.060.1831-3184 B132.67
Autofac19,562.149 ns236.3915 ns209.5549 ns2,224.3694.371.37330.030524208 B1,008.67
'Castle Windsor'31,009.123 ns327.3126 ns306.1684 ns3,531.38141.291.3428-23912 B996.33
Ninject120,850.129 ns2,359.7906 ns3,532.0234 ns14,228.15605.724.27251.098674096 B3,087.33
- - diff --git a/benchmarks/data/Transient.html b/benchmarks/data/Transient.html deleted file mode 100644 index 5eb9268c1..000000000 --- a/benchmarks/data/Transient.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - -Pure.DI.Benchmarks.Benchmarks.Transient-20240413-091543 - - - - -

-BenchmarkDotNet v0.13.12, Ubuntu 20.04.6 LTS (Focal Fossa)
-Intel Xeon Platinum 8175M CPU 2.50GHz, 1 CPU, 2 logical cores and 1 physical core
-.NET SDK 8.0.201
-  [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
-  DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX-512F+CD+BW+DQ+VL
-
-
- - - - - - - - - - - - - - - - -
Method Mean Error StdDev RatioRatioSDGen0Gen1AllocatedAlloc Ratio
'Hand Coded'8.300 ns0.2275 ns0.2017 ns1.000.000.0014-24 B1.00
'Pure.DI composition root'8.417 ns0.2472 ns0.2313 ns1.020.040.0014-24 B1.00
'Pure.DI Resolve<T>()'10.007 ns0.2170 ns0.1924 ns1.210.030.0014-24 B1.00
'Pure.DI Resolve(Type)'10.739 ns0.2942 ns0.4915 ns1.290.060.0014-24 B1.00
LightInject18.968 ns0.4292 ns0.3805 ns2.290.070.0014-24 B1.00
'Microsoft DI'24.761 ns0.2356 ns0.2089 ns2.980.070.0014-24 B1.00
DryIoc26.034 ns0.3170 ns0.2810 ns3.140.060.0014-24 B1.00
'Simple Injector'33.862 ns0.4485 ns0.3976 ns4.080.110.0014-24 B1.00
Unity11,055.904 ns85.9931 ns76.2306 ns1,332.6531.500.2899-5176 B215.67
Autofac28,686.734 ns523.7684 ns464.3070 ns3,458.02103.751.92260.091633224 B1,384.33
'Castle Windsor'57,113.574 ns417.0749 ns369.7260 ns6,883.84138.263.1128-54360 B2,265.00
Ninject259,310.814 ns5,082.3164 ns5,438.0217 ns31,238.771,101.537.32421.9531131008 B5,458.67
- - diff --git a/readme/ArrayDetails.md b/readme/ArrayDetails.md index 400e14ff0..ac3ac4942 100644 --- a/readme/ArrayDetails.md +++ b/readme/ArrayDetails.md @@ -15,7 +15,6 @@ classDiagram class CompositionRoot { +CompositionRoot(IService1 service1, IService2 service21, IService2 service22, IService2 service23, IService3 service3, IService4 service41, IService4 service42) } - class ArrayᐸIService3ᐳ Service1 --|> IService1 : class Service1 { +Service1(IService2 service2) @@ -44,6 +43,7 @@ classDiagram class Service4 { +Service4() } + class ArrayᐸIService3ᐳ class IService1 { <> } @@ -63,10 +63,6 @@ classDiagram CompositionRoot *-- Service3 : IService3 CompositionRoot *-- Service4 : IService4 CompositionRoot *-- Service4 : IService4 - ArrayᐸIService3ᐳ *-- Service3 : IService3 - ArrayᐸIService3ᐳ *-- Service3v2 : 2 IService3 - ArrayᐸIService3ᐳ *-- Service3v3 : 3 IService3 - ArrayᐸIService3ᐳ *-- Service3v4 : 4 IService3 Service1 *-- Service2Array : IService2 Service2Array *-- ArrayᐸIService3ᐳ : ArrayᐸIService3ᐳ Service3 *-- Service4 : IService4 @@ -78,6 +74,10 @@ classDiagram Service3v4 *-- Service4 : IService4 Service3v4 *-- Service4 : IService4 Array ..> CompositionRoot : CompositionRoot TestPureDIByCR() + ArrayᐸIService3ᐳ *-- Service3 : IService3 + ArrayᐸIService3ᐳ *-- Service3v2 : 2 IService3 + ArrayᐸIService3ᐳ *-- Service3v3 : 3 IService3 + ArrayᐸIService3ᐳ *-- Service3v4 : 4 IService3 ``` ### Generated code @@ -88,16 +88,16 @@ classDiagram ```c# partial class Array { - private readonly Array _rootM04D13di; + private readonly Array _rootM04D20di; public Array() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Array(Array baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] @@ -106,31 +106,33 @@ partial class Array 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()); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -143,18 +145,18 @@ partial class Array [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -178,7 +180,6 @@ partial class Array " class CompositionRoot {\n" + " +CompositionRoot(IService1 service1, IService2 service21, IService2 service22, IService2 service23, IService3 service3, IService4 service41, IService4 service42)\n" + " }\n" + - " class ArrayᐸIService3ᐳ\n" + " Service1 --|> IService1 : \n" + " class Service1 {\n" + " +Service1(IService2 service2)\n" + @@ -207,6 +208,7 @@ partial class Array " class Service4 {\n" + " +Service4()\n" + " }\n" + + " class ArrayᐸIService3ᐳ\n" + " class IService1 {\n" + " <>\n" + " }\n" + @@ -226,10 +228,6 @@ partial class Array " CompositionRoot *-- Service3 : IService3\n" + " CompositionRoot *-- Service4 : IService4\n" + " CompositionRoot *-- Service4 : IService4\n" + - " ArrayᐸIService3ᐳ *-- Service3 : IService3\n" + - " ArrayᐸIService3ᐳ *-- Service3v2 : 2 IService3\n" + - " ArrayᐸIService3ᐳ *-- Service3v3 : 3 IService3\n" + - " ArrayᐸIService3ᐳ *-- Service3v4 : 4 IService3\n" + " Service1 *-- Service2Array : IService2\n" + " Service2Array *-- ArrayᐸIService3ᐳ : ArrayᐸIService3ᐳ\n" + " Service3 *-- Service4 : IService4\n" + @@ -240,28 +238,32 @@ partial class Array " Service3v3 *-- Service4 : IService4\n" + " Service3v4 *-- Service4 : IService4\n" + " Service3v4 *-- Service4 : IService4\n" + - " Array ..> CompositionRoot : CompositionRoot TestPureDIByCR()"; + " Array ..> CompositionRoot : CompositionRoot TestPureDIByCR()\n" + + " ArrayᐸIService3ᐳ *-- Service3 : IService3\n" + + " ArrayᐸIService3ᐳ *-- Service3v2 : 2 IService3\n" + + " ArrayᐸIService3ᐳ *-- Service3v3 : 3 IService3\n" + + " ArrayᐸIService3ᐳ *-- Service3v4 : 4 IService3"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Array() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Array composite) { @@ -274,7 +276,7 @@ partial class Array } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Array composition) { diff --git a/readme/Avalonia.md b/readme/Avalonia.md index 9a53c081f..1c3f363c4 100644 --- a/readme/Avalonia.md +++ b/readme/Avalonia.md @@ -107,7 +107,7 @@ The [project file](/samples/AvaloniaApp/AvaloniaApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/BlazorServerApp.md b/readme/BlazorServerApp.md index b3b7863a1..5d8e6f5ff 100644 --- a/readme/BlazorServerApp.md +++ b/readme/BlazorServerApp.md @@ -68,7 +68,7 @@ The [project file](/samples/BlazorServerApp/BlazorServerApp.csproj) looks like t - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/BlazorWebAssemblyApp.md b/readme/BlazorWebAssemblyApp.md index decf7524d..c66cf3e78 100644 --- a/readme/BlazorWebAssemblyApp.md +++ b/readme/BlazorWebAssemblyApp.md @@ -67,7 +67,7 @@ The [project file](/samples/BlazorWebAssemblyApp/BlazorWebAssemblyApp.csproj) lo - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/Console.md b/readme/Console.md index f8b1d69c5..df16b3b76 100644 --- a/readme/Console.md +++ b/readme/Console.md @@ -90,7 +90,7 @@ The [project file](/samples/ShroedingersCat/ShroedingersCat.csproj) looks like t - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/ConsoleNativeAOT.md b/readme/ConsoleNativeAOT.md index 69bd06d1c..d3e834789 100644 --- a/readme/ConsoleNativeAOT.md +++ b/readme/ConsoleNativeAOT.md @@ -16,7 +16,7 @@ The [project file](/samples/ShroedingersCatNativeAOT/ShroedingersCatNativeAOT.cs - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/ConsoleTopLevelStatements.md b/readme/ConsoleTopLevelStatements.md index 26091711e..fc7f58481 100644 --- a/readme/ConsoleTopLevelStatements.md +++ b/readme/ConsoleTopLevelStatements.md @@ -78,7 +78,7 @@ The [project file](/samples/ShroedingersCatTopLevelStatements/ShroedingersCatTop - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/EnumDetails.md b/readme/EnumDetails.md index d71a46c58..32a1d9db1 100644 --- a/readme/EnumDetails.md +++ b/readme/EnumDetails.md @@ -15,7 +15,6 @@ classDiagram class CompositionRoot { +CompositionRoot(IService1 service1, IService2 service21, IService2 service22, IService2 service23, IService3 service3, IService4 service41, IService4 service42) } - class IEnumerableᐸIService3ᐳ Service1 --|> IService1 : class Service1 { +Service1(IService2 service2) @@ -44,6 +43,7 @@ classDiagram class Service4 { +Service4() } + class IEnumerableᐸIService3ᐳ class IService1 { <> } @@ -63,10 +63,6 @@ classDiagram CompositionRoot *-- Service3 : IService3 CompositionRoot *-- Service4 : IService4 CompositionRoot *-- Service4 : IService4 - IEnumerableᐸIService3ᐳ *-- Service3 : IService3 - IEnumerableᐸIService3ᐳ *-- Service3v2 : 2 IService3 - IEnumerableᐸIService3ᐳ *-- Service3v3 : 3 IService3 - IEnumerableᐸIService3ᐳ *-- Service3v4 : 4 IService3 Service1 *-- Service2Enum : IService2 Service2Enum o-- "PerBlock" IEnumerableᐸIService3ᐳ : IEnumerableᐸIService3ᐳ Service3 *-- Service4 : IService4 @@ -78,6 +74,10 @@ classDiagram Service3v4 *-- Service4 : IService4 Service3v4 *-- Service4 : IService4 Enum ..> CompositionRoot : CompositionRoot TestPureDIByCR() + IEnumerableᐸIService3ᐳ *-- Service3 : IService3 + IEnumerableᐸIService3ᐳ *-- Service3v2 : 2 IService3 + IEnumerableᐸIService3ᐳ *-- Service3v3 : 3 IService3 + IEnumerableᐸIService3ᐳ *-- Service3v4 : 4 IService3 ``` ### Generated code @@ -88,58 +88,60 @@ classDiagram ```c# partial class Enum { - private readonly Enum _rootM04D13di; + private readonly Enum _rootM04D20di; public Enum() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Enum(Enum baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public partial Pure.DI.Benchmarks.Model.CompositionRoot TestPureDIByCR() { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable LocalperBlockM04D13di10_IEnumerable() + System.Collections.Generic.IEnumerable LocalperBlockM04D20di10_IEnumerable() { yield return new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); yield return new Pure.DI.Benchmarks.Model.Service3v2(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); yield return new Pure.DI.Benchmarks.Model.Service3v3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); yield return new Pure.DI.Benchmarks.Model.Service3v4(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); } - System.Collections.Generic.IEnumerable perBlockM04D13di10_IEnumerable = LocalperBlockM04D13di10_IEnumerable(); - return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D13di10_IEnumerable)), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D13di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D13di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D13di10_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()); + System.Collections.Generic.IEnumerable perBlockM04D20di10_IEnumerable = LocalperBlockM04D20di10_IEnumerable(); + return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D20di10_IEnumerable)), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D20di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D20di10_IEnumerable), new Pure.DI.Benchmarks.Model.Service2Enum(perBlockM04D20di10_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()); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -152,18 +154,18 @@ partial class Enum [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,7 +189,6 @@ partial class Enum " class CompositionRoot {\n" + " +CompositionRoot(IService1 service1, IService2 service21, IService2 service22, IService2 service23, IService3 service3, IService4 service41, IService4 service42)\n" + " }\n" + - " class IEnumerableᐸIService3ᐳ\n" + " Service1 --|> IService1 : \n" + " class Service1 {\n" + " +Service1(IService2 service2)\n" + @@ -216,6 +217,7 @@ partial class Enum " class Service4 {\n" + " +Service4()\n" + " }\n" + + " class IEnumerableᐸIService3ᐳ\n" + " class IService1 {\n" + " <>\n" + " }\n" + @@ -235,10 +237,6 @@ partial class Enum " CompositionRoot *-- Service3 : IService3\n" + " CompositionRoot *-- Service4 : IService4\n" + " CompositionRoot *-- Service4 : IService4\n" + - " IEnumerableᐸIService3ᐳ *-- Service3 : IService3\n" + - " IEnumerableᐸIService3ᐳ *-- Service3v2 : 2 IService3\n" + - " IEnumerableᐸIService3ᐳ *-- Service3v3 : 3 IService3\n" + - " IEnumerableᐸIService3ᐳ *-- Service3v4 : 4 IService3\n" + " Service1 *-- Service2Enum : IService2\n" + " Service2Enum o-- \"PerBlock\" IEnumerableᐸIService3ᐳ : IEnumerableᐸIService3ᐳ\n" + " Service3 *-- Service4 : IService4\n" + @@ -249,28 +247,32 @@ partial class Enum " Service3v3 *-- Service4 : IService4\n" + " Service3v4 *-- Service4 : IService4\n" + " Service3v4 *-- Service4 : IService4\n" + - " Enum ..> CompositionRoot : CompositionRoot TestPureDIByCR()"; + " Enum ..> CompositionRoot : CompositionRoot TestPureDIByCR()\n" + + " IEnumerableᐸIService3ᐳ *-- Service3 : IService3\n" + + " IEnumerableᐸIService3ᐳ *-- Service3v2 : 2 IService3\n" + + " IEnumerableᐸIService3ᐳ *-- Service3v3 : 3 IService3\n" + + " IEnumerableᐸIService3ᐳ *-- Service3v4 : 4 IService3"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Enum() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Enum composite) { @@ -283,7 +285,7 @@ partial class Enum } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Enum composition) { diff --git a/readme/FuncDetails.md b/readme/FuncDetails.md index 455b4943a..2cedce6c1 100644 --- a/readme/FuncDetails.md +++ b/readme/FuncDetails.md @@ -67,56 +67,58 @@ classDiagram ```c# partial class Func { - private readonly Func _rootM04D13di; + private readonly Func _rootM04D20di; public Func() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Func(Func baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public partial Pure.DI.Benchmarks.Model.CompositionRoot TestPureDIByCR() { - System.Func perBlockM04D13di10_Func = new Func( + System.Func perBlockM04D20di10_Func = new Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var value_M04D13di1 = new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); - return value_M04D13di1; + var value_M04D20di1 = new Pure.DI.Benchmarks.Model.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()); + return value_M04D20di1; }); - return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D13di10_Func)), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D13di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D13di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D13di10_Func), 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()); + return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D20di10_Func)), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D20di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D20di10_Func), new Pure.DI.Benchmarks.Model.Service2Func(perBlockM04D20di10_Func), 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()); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -129,18 +131,18 @@ partial class Func [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -208,25 +210,25 @@ partial class Func " FuncᐸIService3ᐳ *-- Service3 : IService3"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Func() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Func composite) { @@ -239,7 +241,7 @@ partial class Func } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Func composition) { diff --git a/readme/GrpcService.md b/readme/GrpcService.md index 435bbcf48..dc2503269 100644 --- a/readme/GrpcService.md +++ b/readme/GrpcService.md @@ -53,7 +53,7 @@ The [project file](/samples/GrpcService/GrpcService.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/Maui.md b/readme/Maui.md index f1eb55fc7..b06a37012 100644 --- a/readme/Maui.md +++ b/readme/Maui.md @@ -208,7 +208,7 @@ The [project file](/samples/MAUIApp/MAUIApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/MinimalWebAPI.md b/readme/MinimalWebAPI.md index 44c5212e6..52c3d5648 100644 --- a/readme/MinimalWebAPI.md +++ b/readme/MinimalWebAPI.md @@ -76,7 +76,7 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/SingletonDetails.md b/readme/SingletonDetails.md index 5ac70bdcf..a5f66ec2a 100644 --- a/readme/SingletonDetails.md +++ b/readme/SingletonDetails.md @@ -69,59 +69,61 @@ classDiagram ```c# partial class Singleton { - private readonly Singleton _rootM04D13di; - private Pure.DI.Benchmarks.Model.Service1 _scopedM04D13di37_Service1; - private Pure.DI.Benchmarks.Model.Service4 _scopedM04D13di40_Service4; + private readonly Singleton _rootM04D20di; + private Pure.DI.Benchmarks.Model.Service1 _scopedM04D20di37_Service1; + private Pure.DI.Benchmarks.Model.Service4 _scopedM04D20di40_Service4; public Singleton() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Singleton(Singleton baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public partial Pure.DI.Benchmarks.Model.CompositionRoot TestPureDIByCR() { - if (_scopedM04D13di40_Service4 == null) + if (_scopedM04D20di40_Service4 == null) { - _scopedM04D13di40_Service4 = new Pure.DI.Benchmarks.Model.Service4(); + _scopedM04D20di40_Service4 = new Pure.DI.Benchmarks.Model.Service4(); } - if (_scopedM04D13di37_Service1 == null) + if (_scopedM04D20di37_Service1 == null) { - _scopedM04D13di37_Service1 = new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4))); + _scopedM04D20di37_Service1 = new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4))); } - return new Pure.DI.Benchmarks.Model.CompositionRoot(_scopedM04D13di37_Service1, new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4)), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D13di40_Service4, _scopedM04D13di40_Service4), _scopedM04D13di40_Service4, _scopedM04D13di40_Service4); + return new Pure.DI.Benchmarks.Model.CompositionRoot(_scopedM04D20di37_Service1, new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4)), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4)), new Pure.DI.Benchmarks.Model.Service3(_scopedM04D20di40_Service4, _scopedM04D20di40_Service4), _scopedM04D20di40_Service4, _scopedM04D20di40_Service4); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -134,18 +136,18 @@ partial class Singleton [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -215,25 +217,25 @@ partial class Singleton " Singleton ..> CompositionRoot : CompositionRoot TestPureDIByCR()"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Singleton() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Singleton composite) { @@ -246,7 +248,7 @@ partial class Singleton } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Singleton composition) { diff --git a/readme/TransientDetails.md b/readme/TransientDetails.md index 45d7821cb..ca8b0dd2b 100644 --- a/readme/TransientDetails.md +++ b/readme/TransientDetails.md @@ -69,16 +69,16 @@ classDiagram ```c# partial class Transient { - private readonly Transient _rootM04D13di; + private readonly Transient _rootM04D20di; public Transient() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Transient(Transient baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] @@ -87,31 +87,33 @@ partial class Transient return new Pure.DI.Benchmarks.Model.CompositionRoot(new Pure.DI.Benchmarks.Model.Service1(new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(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.Service3(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.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4()))), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(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.Service3(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.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4())), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(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.Service3(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.Service3(new Pure.DI.Benchmarks.Model.Service4(), new Pure.DI.Benchmarks.Model.Service4())), new Pure.DI.Benchmarks.Model.Service2(new Pure.DI.Benchmarks.Model.Service3(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.Service3(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.Service3(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()); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -124,18 +126,18 @@ partial class Transient [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -205,25 +207,25 @@ partial class Transient " Transient ..> CompositionRoot : CompositionRoot TestPureDIByCR()"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Transient() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.Benchmarks.Model.CompositionRoot), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Transient composite) { @@ -236,7 +238,7 @@ partial class Transient } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.Benchmarks.Model.CompositionRoot Resolve(Transient composition) { diff --git a/readme/WebAPI.md b/readme/WebAPI.md index 903b81fc3..6d65c9fd3 100644 --- a/readme/WebAPI.md +++ b/readme/WebAPI.md @@ -51,7 +51,7 @@ The [project file](/samples/WebAPI/WebAPI.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/WebApp.md b/readme/WebApp.md index 1081a6303..b88698f4e 100644 --- a/readme/WebApp.md +++ b/readme/WebApp.md @@ -51,7 +51,7 @@ The [project file](/samples/WebApp/WebApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/WinFormsApp.md b/readme/WinFormsApp.md index 59535e9c7..136b3f8bc 100644 --- a/readme/WinFormsApp.md +++ b/readme/WinFormsApp.md @@ -55,7 +55,7 @@ The [project file](/samples/WinFormsApp/WinFormsApp.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/WinFormsAppNetCore.md b/readme/WinFormsAppNetCore.md index 8ae490b9a..2b4967619 100644 --- a/readme/WinFormsAppNetCore.md +++ b/readme/WinFormsAppNetCore.md @@ -62,7 +62,7 @@ The [project file](/samples/WinFormsAppNetCore/WinFormsAppNetCore.csproj) looks - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/Wpf.md b/readme/Wpf.md index 35027c53f..d1d093223 100644 --- a/readme/Wpf.md +++ b/readme/Wpf.md @@ -68,7 +68,7 @@ The [project file](/samples/WpfAppNetCore/WpfAppNetCore.csproj) looks like this: - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/readme/a-few-partial-classes.md b/readme/a-few-partial-classes.md index 1d33cf881..583a0e0c1 100644 --- a/readme/a-few-partial-classes.md +++ b/readme/a-few-partial-classes.md @@ -79,16 +79,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario.IService Root @@ -100,31 +100,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -137,18 +139,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,25 +189,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -218,7 +220,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.SeveralPartialClassesScenario.IService Resolve(Composition composition) { diff --git a/readme/accumulators.md b/readme/accumulators.md index 19f84b18e..a0f01f033 100644 --- a/readme/accumulators.md +++ b/readme/accumulators.md @@ -90,20 +90,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency _singletonM04D13di38_XyzDependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency _singletonM04D20di38_XyzDependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public (Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator) Root @@ -111,62 +111,64 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var accumulatorM04D13di42 = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator(); - Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency perBlockM04D13di4_AbcDependency = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency(); - if (_rootM04D13di._singletonM04D13di38_XyzDependency == null) + var accumulatorM04D20di42 = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator(); + Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency perBlockM04D20di4_AbcDependency = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency(); + if (_rootM04D20di._singletonM04D20di38_XyzDependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di38_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di38_XyzDependency == null) { - Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency _singletonM04D13di38_XyzDependencyTemp; - _singletonM04D13di38_XyzDependencyTemp = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency(); - accumulatorM04D13di42.Add(_singletonM04D13di38_XyzDependencyTemp); + Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency _singletonM04D20di38_XyzDependencyTemp; + _singletonM04D20di38_XyzDependencyTemp = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.XyzDependency(); + accumulatorM04D20di42.Add(_singletonM04D20di38_XyzDependencyTemp); global::System.Threading.Thread.MemoryBarrier(); - _singletonM04D13di38_XyzDependency = _singletonM04D13di38_XyzDependencyTemp; - _rootM04D13di._singletonM04D13di38_XyzDependency = _singletonM04D13di38_XyzDependency; + _singletonM04D20di38_XyzDependency = _singletonM04D20di38_XyzDependencyTemp; + _rootM04D20di._singletonM04D20di38_XyzDependency = _singletonM04D20di38_XyzDependency; } } } - Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency transientM04D13di3_AbcDependency = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency(); - lock (_lockM04D13di) + Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency transientM04D20di3_AbcDependency = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.AbcDependency(); + lock (_lockM04D20di) { - accumulatorM04D13di42.Add(transientM04D13di3_AbcDependency); + accumulatorM04D20di42.Add(transientM04D20di3_AbcDependency); } - Pure.DI.UsageTests.Advanced.AccumulatorScenario.Service transientM04D13di1_Service = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.Service(transientM04D13di3_AbcDependency, _rootM04D13di._singletonM04D13di38_XyzDependency, perBlockM04D13di4_AbcDependency); - lock (_lockM04D13di) + Pure.DI.UsageTests.Advanced.AccumulatorScenario.Service transientM04D20di1_Service = new Pure.DI.UsageTests.Advanced.AccumulatorScenario.Service(transientM04D20di3_AbcDependency, _rootM04D20di._singletonM04D20di38_XyzDependency, perBlockM04D20di4_AbcDependency); + lock (_lockM04D20di) { - accumulatorM04D13di42.Add(transientM04D13di1_Service); + accumulatorM04D20di42.Add(transientM04D20di1_Service); } - return (transientM04D13di1_Service, accumulatorM04D13di42); + return (transientM04D20di1_Service, accumulatorM04D20di42); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -179,18 +181,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -241,25 +243,25 @@ partial class Composition " Composition ..> ValueTupleᐸIServiceˏMyAccumulatorᐳ : ValueTupleᐸIServiceˏMyAccumulatorᐳ Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di<(Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator)>.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di<(Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator)>.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof((Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator)), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof((Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator)), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -272,7 +274,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver, global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver, global::Pure.DI.IResolver { public (Pure.DI.UsageTests.Advanced.AccumulatorScenario.IService service, Pure.DI.UsageTests.Advanced.AccumulatorScenario.MyAccumulator accumulator) Resolve(Composition composition) { diff --git a/readme/advanced-interception.md b/readme/advanced-interception.md index 357c9072d..acc3543fe 100644 --- a/readme/advanced-interception.md +++ b/readme/advanced-interception.md @@ -147,16 +147,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario.IService Root @@ -168,31 +168,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -205,18 +207,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -257,25 +259,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -288,7 +290,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Interception.AdvancedInterceptionScenario.IService Resolve(Composition composition) { diff --git a/readme/arguments.md b/readme/arguments.md index c65101c64..6836e9c4d 100644 --- a/readme/arguments.md +++ b/readme/arguments.md @@ -96,27 +96,27 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly int _argM04D13di_id; - private readonly string _argM04D13di_serviceName; + private readonly Composition _rootM04D20di; + private readonly int _argM04D20di_id; + private readonly string _argM04D20di_serviceName; public Composition(int id, string serviceName) { - _rootM04D13di = this; + _rootM04D20di = this; if (ReferenceEquals(serviceName, null)) { throw new global::System.ArgumentNullException("serviceName"); } - _argM04D13di_id = id; - _argM04D13di_serviceName = serviceName; + _argM04D20di_id = id; + _argM04D20di_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _argM04D13di_id = baseComposition._argM04D13di_id; - _argM04D13di_serviceName = baseComposition._argM04D13di_serviceName; + _rootM04D20di = baseComposition._rootM04D20di; + _argM04D20di_id = baseComposition._argM04D20di_id; + _argM04D20di_serviceName = baseComposition._argM04D20di_serviceName; } public Pure.DI.UsageTests.Basics.ArgumentsScenario.IService Root @@ -124,35 +124,37 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - return new Pure.DI.UsageTests.Basics.ArgumentsScenario.Service(_argM04D13di_serviceName, new Pure.DI.UsageTests.Basics.ArgumentsScenario.Dependency(_argM04D13di_id)); + return new Pure.DI.UsageTests.Basics.ArgumentsScenario.Service(_argM04D20di_serviceName, new Pure.DI.UsageTests.Basics.ArgumentsScenario.Dependency(_argM04D20di_id)); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -165,18 +167,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -219,25 +221,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ArgumentsScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ArgumentsScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -250,7 +252,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.ArgumentsScenario.IService Resolve(Composition composition) { diff --git a/readme/array.md b/readme/array.md index dbf402f1e..fa6d96e39 100644 --- a/readme/array.md +++ b/readme/array.md @@ -74,7 +74,6 @@ classDiagram + object Resolve(Type type) + object Resolve(Type type, object? tag) } - class ArrayᐸIDependencyᐳ AbcDependency --|> IDependency : class AbcDependency { +AbcDependency() @@ -87,16 +86,17 @@ classDiagram class Service { +Service(ArrayᐸIDependencyᐳ dependencies) } + class ArrayᐸIDependencyᐳ class IDependency { <> } class IService { <> } - ArrayᐸIDependencyᐳ *-- AbcDependency : IDependency - ArrayᐸIDependencyᐳ *-- XyzDependency : 2 IDependency Service *-- ArrayᐸIDependencyᐳ : ArrayᐸIDependencyᐳ Composition ..> Service : IService Root + ArrayᐸIDependencyᐳ *-- AbcDependency : IDependency + ArrayᐸIDependencyᐳ *-- XyzDependency : 2 IDependency ``` @@ -107,16 +107,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.ArrayScenario.IService Root @@ -128,31 +128,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -165,18 +167,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -197,7 +199,6 @@ partial class Composition " + object Resolve(Type type)\n" + " + object Resolve(Type type, object? tag)\n" + " }\n" + - " class ArrayᐸIDependencyᐳ\n" + " AbcDependency --|> IDependency : \n" + " class AbcDependency {\n" + " +AbcDependency()\n" + @@ -210,37 +211,38 @@ partial class Composition " class Service {\n" + " +Service(ArrayᐸIDependencyᐳ dependencies)\n" + " }\n" + + " class ArrayᐸIDependencyᐳ\n" + " class IDependency {\n" + " <>\n" + " }\n" + " class IService {\n" + " <>\n" + " }\n" + - " ArrayᐸIDependencyᐳ *-- AbcDependency : IDependency\n" + - " ArrayᐸIDependencyᐳ *-- XyzDependency : 2 IDependency\n" + " Service *-- ArrayᐸIDependencyᐳ : ArrayᐸIDependencyᐳ\n" + - " Composition ..> Service : IService Root"; + " Composition ..> Service : IService Root\n" + + " ArrayᐸIDependencyᐳ *-- AbcDependency : IDependency\n" + + " ArrayᐸIDependencyᐳ *-- XyzDependency : 2 IDependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ArrayScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ArrayScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -253,7 +255,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ArrayScenario.IService Resolve(Composition composition) { diff --git a/readme/async-enumerable.md b/readme/async-enumerable.md index 34b8702a4..50afa63a2 100644 --- a/readme/async-enumerable.md +++ b/readme/async-enumerable.md @@ -57,7 +57,6 @@ classDiagram + object Resolve(Type type) + object Resolve(Type type, object? tag) } - class IAsyncEnumerableᐸIDependencyᐳ AbcDependency --|> IDependency : class AbcDependency { +AbcDependency() @@ -70,16 +69,17 @@ classDiagram class Service { +Service(IAsyncEnumerableᐸIDependencyᐳ dependencies) } + class IAsyncEnumerableᐸIDependencyᐳ class IDependency { <> } class IService { <> } - IAsyncEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency - IAsyncEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency Service *-- IAsyncEnumerableᐸIDependencyᐳ : IAsyncEnumerableᐸIDependencyᐳ Composition ..> Service : IService Root + IAsyncEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency + IAsyncEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency ``` @@ -90,16 +90,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.IService Root @@ -108,41 +108,43 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - async System.Collections.Generic.IAsyncEnumerable LocaltransientM04D13di1_IAsyncEnumerable() + async System.Collections.Generic.IAsyncEnumerable LocaltransientM04D20di1_IAsyncEnumerable() { yield return new Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.AbcDependency(); yield return new Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.XyzDependency(); } - System.Collections.Generic.IAsyncEnumerable transientM04D13di1_IAsyncEnumerable = LocaltransientM04D13di1_IAsyncEnumerable(); - return new Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.Service(transientM04D13di1_IAsyncEnumerable); + System.Collections.Generic.IAsyncEnumerable transientM04D20di1_IAsyncEnumerable = LocaltransientM04D20di1_IAsyncEnumerable(); + return new Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.Service(transientM04D20di1_IAsyncEnumerable); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -155,18 +157,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,7 +189,6 @@ partial class Composition " + object Resolve(Type type)\n" + " + object Resolve(Type type, object? tag)\n" + " }\n" + - " class IAsyncEnumerableᐸIDependencyᐳ\n" + " AbcDependency --|> IDependency : \n" + " class AbcDependency {\n" + " +AbcDependency()\n" + @@ -200,37 +201,38 @@ partial class Composition " class Service {\n" + " +Service(IAsyncEnumerableᐸIDependencyᐳ dependencies)\n" + " }\n" + + " class IAsyncEnumerableᐸIDependencyᐳ\n" + " class IDependency {\n" + " <>\n" + " }\n" + " class IService {\n" + " <>\n" + " }\n" + - " IAsyncEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency\n" + - " IAsyncEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency\n" + " Service *-- IAsyncEnumerableᐸIDependencyᐳ : IAsyncEnumerableᐸIDependencyᐳ\n" + - " Composition ..> Service : IService Root"; + " Composition ..> Service : IService Root\n" + + " IAsyncEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency\n" + + " IAsyncEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -243,7 +245,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.AsyncEnumerableScenario.IService Resolve(Composition composition) { diff --git a/readme/auto-bindings.md b/readme/auto-bindings.md index 8572dcccc..8f38dd3c0 100644 --- a/readme/auto-bindings.md +++ b/readme/auto-bindings.md @@ -51,16 +51,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.AutoBindingsScenario.Service MyService diff --git a/readme/auto-scoped.md b/readme/auto-scoped.md index 388085d38..2007d9b6a 100644 --- a/readme/auto-scoped.md +++ b/readme/auto-scoped.md @@ -80,13 +80,13 @@ classDiagram class Service { +Service(IDependency dependency) } - class Composition class IService Dependency --|> IDependency : class Dependency { +Dependency() } class FuncᐸIServiceᐳ + class Composition class IDependency { <> } @@ -106,20 +106,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Dependency _scopedM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Dependency _scopedM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } private Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service SessionRoot @@ -127,17 +127,17 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_scopedM04D13di36_Dependency == null) + if (_scopedM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_scopedM04D13di36_Dependency == null) + if (_scopedM04D20di36_Dependency == null) { - _scopedM04D13di36_Dependency = new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Dependency(); + _scopedM04D20di36_Dependency = new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Dependency(); } } } - return new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service(_scopedM04D13di36_Dependency); + return new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service(_scopedM04D20di36_Dependency); } } @@ -146,51 +146,53 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var perResolveM04D13di42_Func = default(System.Func); - perResolveM04D13di42_Func = new global::System.Func( + var perResolveM04D20di43_Func = default(System.Func); + perResolveM04D20di43_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Composition transientM04D13di2_Composition = this; - Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.IService transientM04D13di1_IService; + Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Composition transientM04D20di2_Composition = this; + Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.IService transientM04D20di1_IService; { - var baseComposition_M04D13di2 = transientM04D13di2_Composition; + var baseComposition_M04D20di2 = transientM04D20di2_Composition; // Creates a session - var session_M04D13di3 = new Composition(baseComposition_M04D13di2); - transientM04D13di1_IService = session_M04D13di3.SessionRoot; + var session_M04D20di3 = new Composition(baseComposition_M04D20di2); + transientM04D20di1_IService = session_M04D20di3.SessionRoot; } - var factory_M04D13di1 = transientM04D13di1_IService; - return factory_M04D13di1; + var value_M04D20di1 = transientM04D20di1_IService; + return value_M04D20di1; }); - return new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program(perResolveM04D13di42_Func); + return new Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program(perResolveM04D20di43_Func); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -203,18 +205,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -242,13 +244,13 @@ partial class Composition " class Service {\n" + " +Service(IDependency dependency)\n" + " }\n" + - " class Composition\n" + " class IService\n" + " Dependency --|> IDependency : \n" + " class Dependency {\n" + " +Dependency()\n" + " }\n" + " class FuncᐸIServiceᐳ\n" + + " class Composition\n" + " class IDependency {\n" + " <>\n" + " }\n" + @@ -260,28 +262,28 @@ partial class Composition " FuncᐸIServiceᐳ *-- IService : IService"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -294,7 +296,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Service Resolve(Composition composition) { @@ -313,7 +315,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.AutoScopedScenario.Program Resolve(Composition composition) { diff --git a/readme/check-for-a-root.md b/readme/check-for-a-root.md index da043fa81..485700cae 100644 --- a/readme/check-for-a-root.md +++ b/readme/check-for-a-root.md @@ -99,16 +99,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Hints.CheckForRootScenario.IService Root @@ -123,7 +123,7 @@ partial class Composition } } - private Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency RootM04D13di0001 + private Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency RootM04D20di0001 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get @@ -132,31 +132,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -169,18 +171,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -222,32 +224,32 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; private static partial void OnNewRoot(global::Pure.DI.IResolver resolver, string name, object? tag, global::Pure.DI.Lifetime lifetime); static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - OnNewRoot(valResolverM04D13di_0000, "Root", null, Pure.DI.Lifetime.Transient); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - OnNewRoot(valResolverM04D13di_0001, "RootM04D13di0001", "MyDep", Pure.DI.Lifetime.Transient); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + OnNewRoot(valResolverM04D20di_0000, "Root", null, Pure.DI.Lifetime.Transient); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + OnNewRoot(valResolverM04D20di_0001, "RootM04D20di0001", "MyDep", Pure.DI.Lifetime.Transient); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.CheckForRootScenario.IService), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.CheckForRootScenario.IService), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -260,7 +262,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.CheckForRootScenario.IService Resolve(Composition composition) { @@ -279,7 +281,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency Resolve(Composition composition) { @@ -291,7 +293,7 @@ partial class Composition switch (tag) { case "MyDep": - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Hints.CheckForRootScenario.IDependency."); } diff --git a/readme/complex-generics.md b/readme/complex-generics.md index eec830945..bc2016ed7 100644 --- a/readme/complex-generics.md +++ b/readme/complex-generics.md @@ -110,16 +110,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Generics.ComplexGenericsScenario.Program Root @@ -131,31 +131,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -168,18 +170,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -230,25 +232,25 @@ partial class Composition " ServiceᐸStringˏInt32ˏListᐸStringᐳˏDictionaryᐸStringˏInt32ᐳᐳ *-- DependencyStructᐸInt32ᐳ : \"value type\" IDependencyᐸInt32ᐳ"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di>.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di>.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Generics.ComplexGenericsScenario.Program), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Generics.ComplexGenericsScenario.Program), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -261,7 +263,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver> + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver> { public Pure.DI.UsageTests.Generics.ComplexGenericsScenario.Program Resolve(Composition composition) { diff --git a/readme/composition-root-kinds.md b/readme/composition-root-kinds.md index acce24075..099c23e82 100644 --- a/readme/composition-root-kinds.md +++ b/readme/composition-root-kinds.md @@ -90,16 +90,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] @@ -123,31 +123,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -160,18 +162,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -218,28 +220,28 @@ partial class Composition " Composition ..> Dependency : IDependency Dependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IService), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IDependency), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IService), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IDependency), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -252,7 +254,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IService Resolve(Composition composition) { @@ -273,7 +275,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.CompositionRootKindsScenario.IDependency Resolve(Composition composition) { diff --git a/readme/composition-roots-simplified.md b/readme/composition-roots-simplified.md index 6f6e3c3ee..0fe29f32f 100644 --- a/readme/composition-roots-simplified.md +++ b/readme/composition-roots-simplified.md @@ -83,16 +83,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService MyRoot @@ -104,7 +104,7 @@ partial class Composition } } - private Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService RootM04D13di0002 + private Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService RootM04D20di0002 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get @@ -113,31 +113,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -150,18 +152,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -206,25 +208,25 @@ partial class Composition " Composition ..> OtherService : IService _"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -237,7 +239,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.CompositionRootsSimplifiedScenario.IService Resolve(Composition composition) { @@ -249,7 +251,7 @@ partial class Composition switch (tag) { case "Other": - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; case null: return composition.MyRoot; default: diff --git a/readme/composition-roots.md b/readme/composition-roots.md index 4d3f7ac11..5cadfc4e8 100644 --- a/readme/composition-roots.md +++ b/readme/composition-roots.md @@ -109,16 +109,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IService MyRoot @@ -139,7 +139,7 @@ partial class Composition } } - private Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency RootM04D13di0003 + private Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency RootM04D20di0003 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get @@ -148,31 +148,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -185,18 +187,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -243,28 +245,28 @@ partial class Composition " Composition ..> Dependency : IDependency _"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsScenario.IService), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsScenario.IService), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -277,7 +279,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IService Resolve(Composition composition) { @@ -298,11 +300,11 @@ partial class Composition } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency Resolve(Composition composition) { - return composition.RootM04D13di0003; + return composition.RootM04D20di0003; } public Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency ResolveByTag(Composition composition, object tag) @@ -310,7 +312,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D13di0003; + return composition.RootM04D20di0003; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Basics.CompositionRootsScenario.IDependency."); } diff --git a/readme/constructor-ordinal-attribute.md b/readme/constructor-ordinal-attribute.md index 4653ff90a..067149143 100644 --- a/readme/constructor-ordinal-attribute.md +++ b/readme/constructor-ordinal-attribute.md @@ -74,24 +74,24 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly string _argM04D13di_serviceName; + private readonly Composition _rootM04D20di; + private readonly string _argM04D20di_serviceName; public Composition(string serviceName) { - _rootM04D13di = this; + _rootM04D20di = this; if (ReferenceEquals(serviceName, null)) { throw new global::System.ArgumentNullException("serviceName"); } - _argM04D13di_serviceName = serviceName; + _argM04D20di_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _argM04D13di_serviceName = baseComposition._argM04D13di_serviceName; + _rootM04D20di = baseComposition._rootM04D20di; + _argM04D20di_serviceName = baseComposition._argM04D20di_serviceName; } public Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.IService Root @@ -99,35 +99,37 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - return new Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.Service(_argM04D13di_serviceName); + return new Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.Service(_argM04D20di_serviceName); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -140,18 +142,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -184,25 +186,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -215,7 +217,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Attributes.ConstructorOrdinalAttributeScenario.IService Resolve(Composition composition) { diff --git a/readme/custom-attributes.md b/readme/custom-attributes.md index 44dbc3f6f..f3afbede5 100644 --- a/readme/custom-attributes.md +++ b/readme/custom-attributes.md @@ -90,19 +90,19 @@ classDiagram ```c# partial class PersonComposition { - private readonly PersonComposition _rootM04D13di; - private readonly int _argM04D13di_personId; + private readonly PersonComposition _rootM04D20di; + private readonly int _argM04D20di_personId; public PersonComposition(int personId) { - _rootM04D13di = this; - _argM04D13di_personId = personId; + _rootM04D20di = this; + _argM04D20di_personId = personId; } internal PersonComposition(PersonComposition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _argM04D13di_personId = baseComposition._argM04D13di_personId; + _rootM04D20di = baseComposition._rootM04D20di; + _argM04D20di_personId = baseComposition._argM04D20di_personId; } public Pure.DI.UsageTests.Attributes.CustomAttributesScenario.IPerson Person @@ -110,38 +110,40 @@ partial class PersonComposition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - string transientM04D13di1_String = "Nik"; - Pure.DI.UsageTests.Attributes.CustomAttributesScenario.Person transientM04D13di0_Person = new Pure.DI.UsageTests.Attributes.CustomAttributesScenario.Person(transientM04D13di1_String); - transientM04D13di0_Person.Id = _argM04D13di_personId; - return transientM04D13di0_Person; + string transientM04D20di1_String = "Nik"; + Pure.DI.UsageTests.Attributes.CustomAttributesScenario.Person transientM04D20di0_Person = new Pure.DI.UsageTests.Attributes.CustomAttributesScenario.Person(transientM04D20di1_String); + transientM04D20di0_Person.Id = _argM04D20di_personId; + return transientM04D20di0_Person; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -154,18 +156,18 @@ partial class PersonComposition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -201,25 +203,25 @@ partial class PersonComposition " PersonComposition ..> Person : IPerson Person"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static PersonComposition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.CustomAttributesScenario.IPerson), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.CustomAttributesScenario.IPerson), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(PersonComposition composite) { @@ -232,7 +234,7 @@ partial class PersonComposition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Attributes.CustomAttributesScenario.IPerson Resolve(PersonComposition composition) { diff --git a/readme/decorator.md b/readme/decorator.md index 440040bed..fd7861ca9 100644 --- a/readme/decorator.md +++ b/readme/decorator.md @@ -64,16 +64,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Interception.DecoratorScenario.IService Root @@ -85,31 +85,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -122,18 +124,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -169,25 +171,25 @@ partial class Composition " Composition ..> GreetingService : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.DecoratorScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.DecoratorScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -200,7 +202,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Interception.DecoratorScenario.IService Resolve(Composition composition) { diff --git a/readme/default-lifetime.md b/readme/default-lifetime.md index 9aa66d98f..3890133af 100644 --- a/readme/default-lifetime.md +++ b/readme/default-lifetime.md @@ -77,21 +77,21 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Service _singletonM04D13di37_Service; - private Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Dependency _singletonM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Service _singletonM04D20di37_Service; + private Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Dependency _singletonM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.IService Root @@ -99,51 +99,53 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di37_Service == null) + if (_rootM04D20di._singletonM04D20di37_Service == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di37_Service == null) + if (_rootM04D20di._singletonM04D20di37_Service == null) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } - _singletonM04D13di37_Service = new Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Service(_singletonM04D13di36_Dependency, _rootM04D13di._singletonM04D13di36_Dependency); - _rootM04D13di._singletonM04D13di37_Service = _singletonM04D13di37_Service; + _singletonM04D20di37_Service = new Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.Service(_singletonM04D20di36_Dependency, _rootM04D20di._singletonM04D20di36_Dependency); + _rootM04D20di._singletonM04D20di37_Service = _singletonM04D20di37_Service; } } } - return _rootM04D13di._singletonM04D13di37_Service; + return _rootM04D20di._singletonM04D20di37_Service; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -156,18 +158,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -207,25 +209,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -238,7 +240,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.DefaultLifetimeScenario.IService Resolve(Composition composition) { diff --git a/readme/default-values.md b/readme/default-values.md index bfdb2dacf..dd1245511 100644 --- a/readme/default-values.md +++ b/readme/default-values.md @@ -73,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.DefaultValuesScenario.IService Root @@ -97,31 +97,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -134,18 +136,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -185,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.DefaultValuesScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.DefaultValuesScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -216,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.DefaultValuesScenario.IService Resolve(Composition composition) { diff --git a/readme/dependent-compositions.md b/readme/dependent-compositions.md index 11feb99bb..319aa114b 100644 --- a/readme/dependent-compositions.md +++ b/readme/dependent-compositions.md @@ -90,16 +90,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService Root @@ -111,31 +111,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -148,18 +150,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -198,25 +200,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -229,7 +231,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService Resolve(Composition composition) { @@ -258,16 +260,16 @@ partial class Composition ```c# partial class OtherComposition { - private readonly OtherComposition _rootM04D13di; + private readonly OtherComposition _rootM04D20di; public OtherComposition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal OtherComposition(OtherComposition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService Root @@ -288,31 +290,33 @@ partial class OtherComposition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -325,18 +329,18 @@ partial class OtherComposition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -381,28 +385,28 @@ partial class OtherComposition " OtherComposition ..> Program : Program Program"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static OtherComposition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.Program), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.Program), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(OtherComposition composite) { @@ -415,7 +419,7 @@ partial class OtherComposition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.IService Resolve(OtherComposition composition) { @@ -434,7 +438,7 @@ partial class OtherComposition } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.DependentCompositionsScenario.Program Resolve(OtherComposition composition) { diff --git a/readme/disposable-singleton.md b/readme/disposable-singleton.md index 66d5075c1..28c62dfc1 100644 --- a/readme/disposable-singleton.md +++ b/readme/disposable-singleton.md @@ -82,23 +82,23 @@ classDiagram ```c# partial class Composition: global::System.IDisposable { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private readonly global::System.IDisposable[] _disposablesM04D13di; - private int _disposeIndexM04D13di; - private Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Dependency _singletonM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private readonly global::System.IDisposable[] _disposablesM04D20di; + private int _disposeIndexM04D20di; + private Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Dependency _singletonM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); - _disposablesM04D13di = new global::System.IDisposable[1]; + _rootM04D20di = this; + _lockM04D20di = new object(); + _disposablesM04D20di = new global::System.IDisposable[1]; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.IService Root @@ -106,47 +106,49 @@ partial class Composition: global::System.IDisposable [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; - _rootM04D13di._disposablesM04D13di[_rootM04D13di._disposeIndexM04D13di++] = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; + _rootM04D20di._disposablesM04D20di[_rootM04D20di._disposeIndexM04D20di++] = _singletonM04D20di36_Dependency; } } } - return new Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Service(_rootM04D13di._singletonM04D13di36_Dependency); + return new Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.Service(_rootM04D20di._singletonM04D20di36_Dependency); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -159,18 +161,18 @@ partial class Composition: global::System.IDisposable [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -183,11 +185,11 @@ partial class Composition: global::System.IDisposable public void Dispose() { - lock (_lockM04D13di) + lock (_lockM04D20di) { - while (_disposeIndexM04D13di > 0) + while (_disposeIndexM04D20di > 0) { - var disposableInstance = _disposablesM04D13di[--_disposeIndexM04D13di]; + var disposableInstance = _disposablesM04D20di[--_disposeIndexM04D20di]; try { disposableInstance.Dispose(); @@ -198,7 +200,7 @@ partial class Composition: global::System.IDisposable } } - _singletonM04D13di36_Dependency = null; + _singletonM04D20di36_Dependency = null; } } @@ -234,25 +236,25 @@ partial class Composition: global::System.IDisposable " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -265,7 +267,7 @@ partial class Composition: global::System.IDisposable } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.DisposableSingletonScenario.IService Resolve(Composition composition) { diff --git a/readme/enumerable-generics.md b/readme/enumerable-generics.md index b2a86aa22..a60e68f09 100644 --- a/readme/enumerable-generics.md +++ b/readme/enumerable-generics.md @@ -55,16 +55,16 @@ classDiagram + object Resolve(Type type) + object Resolve(Type type, object? tag) } - class IEnumerableᐸIDependencyᐸStringᐳᐳ - class IEnumerableᐸIDependencyᐸInt32ᐳᐳ - AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : - class AbcDependencyᐸStringᐳ { - +AbcDependency() + ServiceᐸInt32ᐳ --|> IServiceᐸInt32ᐳ : + class ServiceᐸInt32ᐳ { + +Service(IEnumerableᐸIDependencyᐸInt32ᐳᐳ dependencies) } - XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : "Xyz" - class XyzDependencyᐸStringᐳ { - +XyzDependency() + ServiceᐸStringᐳ --|> IServiceᐸStringᐳ : + class ServiceᐸStringᐳ { + +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies) } + class IEnumerableᐸIDependencyᐸInt32ᐳᐳ + class IEnumerableᐸIDependencyᐸStringᐳᐳ AbcDependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ : class AbcDependencyᐸInt32ᐳ { +AbcDependency() @@ -73,34 +73,34 @@ classDiagram class XyzDependencyᐸInt32ᐳ { +XyzDependency() } - ServiceᐸInt32ᐳ --|> IServiceᐸInt32ᐳ : - class ServiceᐸInt32ᐳ { - +Service(IEnumerableᐸIDependencyᐸInt32ᐳᐳ dependencies) + AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : + class AbcDependencyᐸStringᐳ { + +AbcDependency() } - ServiceᐸStringᐳ --|> IServiceᐸStringᐳ : - class ServiceᐸStringᐳ { - +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies) + XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : "Xyz" + class XyzDependencyᐸStringᐳ { + +XyzDependency() } - class IDependencyᐸStringᐳ { + class IServiceᐸInt32ᐳ { <> } - class IDependencyᐸInt32ᐳ { + class IServiceᐸStringᐳ { <> } - class IServiceᐸInt32ᐳ { + class IDependencyᐸInt32ᐳ { <> } - class IServiceᐸStringᐳ { + class IDependencyᐸStringᐳ { <> } - IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : IDependencyᐸStringᐳ - IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : "Xyz" IDependencyᐸStringᐳ - IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- AbcDependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ - IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- XyzDependencyᐸInt32ᐳ : "Xyz" IDependencyᐸInt32ᐳ Composition ..> ServiceᐸInt32ᐳ : IServiceᐸInt32ᐳ IntRoot Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ StringRoot ServiceᐸInt32ᐳ o-- "PerBlock" IEnumerableᐸIDependencyᐸInt32ᐳᐳ : IEnumerableᐸIDependencyᐸInt32ᐳᐳ ServiceᐸStringᐳ o-- "PerBlock" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ + IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- AbcDependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ + IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- XyzDependencyᐸInt32ᐳ : "Xyz" IDependencyᐸInt32ᐳ + IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : IDependencyᐸStringᐳ + IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : "Xyz" IDependencyᐸStringᐳ ``` @@ -111,16 +111,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService IntRoot @@ -129,13 +129,13 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM04D13di1_IEnumerable() + System.Collections.Generic.IEnumerable> LocalperBlockM04D20di1_IEnumerable() { yield return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.AbcDependency(); yield return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM04D13di1_IEnumerable = LocalperBlockM04D13di1_IEnumerable(); - return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.Service(perBlockM04D13di1_IEnumerable); + System.Collections.Generic.IEnumerable> perBlockM04D20di1_IEnumerable = LocalperBlockM04D20di1_IEnumerable(); + return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.Service(perBlockM04D20di1_IEnumerable); } } @@ -145,41 +145,43 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM04D13di1_IEnumerable() + System.Collections.Generic.IEnumerable> LocalperBlockM04D20di1_IEnumerable() { yield return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.AbcDependency(); yield return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM04D13di1_IEnumerable = LocalperBlockM04D13di1_IEnumerable(); - return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.Service(perBlockM04D13di1_IEnumerable); + System.Collections.Generic.IEnumerable> perBlockM04D20di1_IEnumerable = LocalperBlockM04D20di1_IEnumerable(); + return new Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.Service(perBlockM04D20di1_IEnumerable); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -192,18 +194,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -225,16 +227,16 @@ partial class Composition " + object Resolve(Type type)\n" + " + object Resolve(Type type, object? tag)\n" + " }\n" + - " class IEnumerableᐸIDependencyᐸStringᐳᐳ\n" + - " class IEnumerableᐸIDependencyᐸInt32ᐳᐳ\n" + - " AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : \n" + - " class AbcDependencyᐸStringᐳ {\n" + - " +AbcDependency()\n" + + " ServiceᐸInt32ᐳ --|> IServiceᐸInt32ᐳ : \n" + + " class ServiceᐸInt32ᐳ {\n" + + " +Service(IEnumerableᐸIDependencyᐸInt32ᐳᐳ dependencies)\n" + " }\n" + - " XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : \"Xyz\" \n" + - " class XyzDependencyᐸStringᐳ {\n" + - " +XyzDependency()\n" + + " ServiceᐸStringᐳ --|> IServiceᐸStringᐳ : \n" + + " class ServiceᐸStringᐳ {\n" + + " +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies)\n" + " }\n" + + " class IEnumerableᐸIDependencyᐸInt32ᐳᐳ\n" + + " class IEnumerableᐸIDependencyᐸStringᐳᐳ\n" + " AbcDependencyᐸInt32ᐳ --|> IDependencyᐸInt32ᐳ : \n" + " class AbcDependencyᐸInt32ᐳ {\n" + " +AbcDependency()\n" + @@ -243,58 +245,58 @@ partial class Composition " class XyzDependencyᐸInt32ᐳ {\n" + " +XyzDependency()\n" + " }\n" + - " ServiceᐸInt32ᐳ --|> IServiceᐸInt32ᐳ : \n" + - " class ServiceᐸInt32ᐳ {\n" + - " +Service(IEnumerableᐸIDependencyᐸInt32ᐳᐳ dependencies)\n" + + " AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : \n" + + " class AbcDependencyᐸStringᐳ {\n" + + " +AbcDependency()\n" + " }\n" + - " ServiceᐸStringᐳ --|> IServiceᐸStringᐳ : \n" + - " class ServiceᐸStringᐳ {\n" + - " +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies)\n" + + " XyzDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : \"Xyz\" \n" + + " class XyzDependencyᐸStringᐳ {\n" + + " +XyzDependency()\n" + " }\n" + - " class IDependencyᐸStringᐳ {\n" + + " class IServiceᐸInt32ᐳ {\n" + " <>\n" + " }\n" + - " class IDependencyᐸInt32ᐳ {\n" + + " class IServiceᐸStringᐳ {\n" + " <>\n" + " }\n" + - " class IServiceᐸInt32ᐳ {\n" + + " class IDependencyᐸInt32ᐳ {\n" + " <>\n" + " }\n" + - " class IServiceᐸStringᐳ {\n" + + " class IDependencyᐸStringᐳ {\n" + " <>\n" + " }\n" + - " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : IDependencyᐸStringᐳ\n" + - " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : \"Xyz\" IDependencyᐸStringᐳ\n" + - " IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- AbcDependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ\n" + - " IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- XyzDependencyᐸInt32ᐳ : \"Xyz\" IDependencyᐸInt32ᐳ\n" + " Composition ..> ServiceᐸInt32ᐳ : IServiceᐸInt32ᐳ IntRoot\n" + " Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ StringRoot\n" + " ServiceᐸInt32ᐳ o-- \"PerBlock\" IEnumerableᐸIDependencyᐸInt32ᐳᐳ : IEnumerableᐸIDependencyᐸInt32ᐳᐳ\n" + - " ServiceᐸStringᐳ o-- \"PerBlock\" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ"; + " ServiceᐸStringᐳ o-- \"PerBlock\" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ\n" + + " IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- AbcDependencyᐸInt32ᐳ : IDependencyᐸInt32ᐳ\n" + + " IEnumerableᐸIDependencyᐸInt32ᐳᐳ *-- XyzDependencyᐸInt32ᐳ : \"Xyz\" IDependencyᐸInt32ᐳ\n" + + " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : IDependencyᐸStringᐳ\n" + + " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : \"Xyz\" IDependencyᐸStringᐳ"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di>.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di>.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di>.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di>.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -307,7 +309,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver> + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver> { public Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService Resolve(Composition composition) { @@ -326,7 +328,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver> + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver> { public Pure.DI.UsageTests.BCL.EnumerableGenericsScenario.IService Resolve(Composition composition) { diff --git a/readme/enumerable.md b/readme/enumerable.md index eb5abbc3f..5049550b9 100644 --- a/readme/enumerable.md +++ b/readme/enumerable.md @@ -49,7 +49,6 @@ classDiagram + object Resolve(Type type) + object Resolve(Type type, object? tag) } - class IEnumerableᐸIDependencyᐳ AbcDependency --|> IDependency : class AbcDependency { +AbcDependency() @@ -62,16 +61,17 @@ classDiagram class Service { +Service(IEnumerableᐸIDependencyᐳ dependencies) } + class IEnumerableᐸIDependencyᐳ class IDependency { <> } class IService { <> } - IEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency - IEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency Service o-- "PerBlock" IEnumerableᐸIDependencyᐳ : IEnumerableᐸIDependencyᐳ Composition ..> Service : IService Root + IEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency + IEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency ``` @@ -82,16 +82,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.EnumerableScenario.IService Root @@ -100,41 +100,43 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable LocalperBlockM04D13di1_IEnumerable() + System.Collections.Generic.IEnumerable LocalperBlockM04D20di1_IEnumerable() { yield return new Pure.DI.UsageTests.BCL.EnumerableScenario.AbcDependency(); yield return new Pure.DI.UsageTests.BCL.EnumerableScenario.XyzDependency(); } - System.Collections.Generic.IEnumerable perBlockM04D13di1_IEnumerable = LocalperBlockM04D13di1_IEnumerable(); - return new Pure.DI.UsageTests.BCL.EnumerableScenario.Service(perBlockM04D13di1_IEnumerable); + System.Collections.Generic.IEnumerable perBlockM04D20di1_IEnumerable = LocalperBlockM04D20di1_IEnumerable(); + return new Pure.DI.UsageTests.BCL.EnumerableScenario.Service(perBlockM04D20di1_IEnumerable); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -147,18 +149,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -179,7 +181,6 @@ partial class Composition " + object Resolve(Type type)\n" + " + object Resolve(Type type, object? tag)\n" + " }\n" + - " class IEnumerableᐸIDependencyᐳ\n" + " AbcDependency --|> IDependency : \n" + " class AbcDependency {\n" + " +AbcDependency()\n" + @@ -192,37 +193,38 @@ partial class Composition " class Service {\n" + " +Service(IEnumerableᐸIDependencyᐳ dependencies)\n" + " }\n" + + " class IEnumerableᐸIDependencyᐳ\n" + " class IDependency {\n" + " <>\n" + " }\n" + " class IService {\n" + " <>\n" + " }\n" + - " IEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency\n" + - " IEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency\n" + " Service o-- \"PerBlock\" IEnumerableᐸIDependencyᐳ : IEnumerableᐸIDependencyᐳ\n" + - " Composition ..> Service : IService Root"; + " Composition ..> Service : IService Root\n" + + " IEnumerableᐸIDependencyᐳ *-- AbcDependency : IDependency\n" + + " IEnumerableᐸIDependencyᐳ *-- XyzDependency : 2 IDependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.EnumerableScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -235,7 +237,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.EnumerableScenario.IService Resolve(Composition composition) { diff --git a/readme/factory.md b/readme/factory.md index 4dfb53d93..a66b79a42 100644 --- a/readme/factory.md +++ b/readme/factory.md @@ -67,10 +67,10 @@ classDiagram DateTimeOffset --|> IComparable : DateTimeOffset --|> IComparableᐸDateTimeOffsetᐳ : DateTimeOffset --|> IEquatableᐸDateTimeOffsetᐳ : - DateTimeOffset --|> ISpanFormattable : DateTimeOffset --|> IFormattable : - DateTimeOffset --|> ISpanParsableᐸDateTimeOffsetᐳ : DateTimeOffset --|> IParsableᐸDateTimeOffsetᐳ : + DateTimeOffset --|> ISpanFormattable : + DateTimeOffset --|> ISpanParsableᐸDateTimeOffsetᐳ : DateTimeOffset --|> IDeserializationCallback : DateTimeOffset --|> ISerializable : DateTimeOffset --|> IUtf8SpanFormattable : @@ -88,16 +88,16 @@ classDiagram class IEquatableᐸDateTimeOffsetᐳ { <> } - class ISpanFormattable { + class IFormattable { <> } - class IFormattable { + class IParsableᐸDateTimeOffsetᐳ { <> } - class ISpanParsableᐸDateTimeOffsetᐳ { + class ISpanFormattable { <> } - class IParsableᐸDateTimeOffsetᐳ { + class ISpanParsableᐸDateTimeOffsetᐳ { <> } class IDeserializationCallback { @@ -125,16 +125,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.FactoryScenario.IService Root @@ -142,42 +142,44 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - System.DateTimeOffset transientM04D13di3_DateTimeOffset = DateTimeOffset.Now; - Pure.DI.UsageTests.Basics.FactoryScenario.Dependency transientM04D13di1_Dependency; + System.DateTimeOffset transientM04D20di3_DateTimeOffset = DateTimeOffset.Now; + Pure.DI.UsageTests.Basics.FactoryScenario.Dependency transientM04D20di1_Dependency; { - var dependency_M04D13di1 = new Pure.DI.UsageTests.Basics.FactoryScenario.Dependency(transientM04D13di3_DateTimeOffset); - dependency_M04D13di1.Initialize(); - transientM04D13di1_Dependency = dependency_M04D13di1; + var dependency_M04D20di1 = new Pure.DI.UsageTests.Basics.FactoryScenario.Dependency(transientM04D20di3_DateTimeOffset); + dependency_M04D20di1.Initialize(); + transientM04D20di1_Dependency = dependency_M04D20di1; } - return new Pure.DI.UsageTests.Basics.FactoryScenario.Service(transientM04D13di1_Dependency); + return new Pure.DI.UsageTests.Basics.FactoryScenario.Service(transientM04D20di1_Dependency); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -190,18 +192,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -228,10 +230,10 @@ partial class Composition " DateTimeOffset --|> IComparable : \n" + " DateTimeOffset --|> IComparableᐸDateTimeOffsetᐳ : \n" + " DateTimeOffset --|> IEquatableᐸDateTimeOffsetᐳ : \n" + - " DateTimeOffset --|> ISpanFormattable : \n" + " DateTimeOffset --|> IFormattable : \n" + - " DateTimeOffset --|> ISpanParsableᐸDateTimeOffsetᐳ : \n" + " DateTimeOffset --|> IParsableᐸDateTimeOffsetᐳ : \n" + + " DateTimeOffset --|> ISpanFormattable : \n" + + " DateTimeOffset --|> ISpanParsableᐸDateTimeOffsetᐳ : \n" + " DateTimeOffset --|> IDeserializationCallback : \n" + " DateTimeOffset --|> ISerializable : \n" + " DateTimeOffset --|> IUtf8SpanFormattable : \n" + @@ -249,16 +251,16 @@ partial class Composition " class IEquatableᐸDateTimeOffsetᐳ {\n" + " <>\n" + " }\n" + - " class ISpanFormattable {\n" + + " class IFormattable {\n" + " <>\n" + " }\n" + - " class IFormattable {\n" + + " class IParsableᐸDateTimeOffsetᐳ {\n" + " <>\n" + " }\n" + - " class ISpanParsableᐸDateTimeOffsetᐳ {\n" + + " class ISpanFormattable {\n" + " <>\n" + " }\n" + - " class IParsableᐸDateTimeOffsetᐳ {\n" + + " class ISpanParsableᐸDateTimeOffsetᐳ {\n" + " <>\n" + " }\n" + " class IDeserializationCallback {\n" + @@ -278,25 +280,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.FactoryScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.FactoryScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -309,7 +311,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.FactoryScenario.IService Resolve(Composition composition) { diff --git a/readme/field-injection.md b/readme/field-injection.md index 72b53dc47..4d5b9692e 100644 --- a/readme/field-injection.md +++ b/readme/field-injection.md @@ -73,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.FieldInjectionScenario.IService Root @@ -90,37 +90,39 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.Basics.FieldInjectionScenario.Service transientM04D13di0_Service = new Pure.DI.UsageTests.Basics.FieldInjectionScenario.Service(); - transientM04D13di0_Service.DependencyVal = new Pure.DI.UsageTests.Basics.FieldInjectionScenario.Dependency(); - return transientM04D13di0_Service; + Pure.DI.UsageTests.Basics.FieldInjectionScenario.Service transientM04D20di0_Service = new Pure.DI.UsageTests.Basics.FieldInjectionScenario.Service(); + transientM04D20di0_Service.DependencyVal = new Pure.DI.UsageTests.Basics.FieldInjectionScenario.Dependency(); + return transientM04D20di0_Service; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -133,18 +135,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -184,25 +186,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.FieldInjectionScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.FieldInjectionScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -215,7 +217,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.FieldInjectionScenario.IService Resolve(Composition composition) { diff --git a/readme/func-with-arguments.md b/readme/func-with-arguments.md index 59f8fe496..5ed66360b 100644 --- a/readme/func-with-arguments.md +++ b/readme/func-with-arguments.md @@ -110,20 +110,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Clock _singletonM04D13di36_Clock; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Clock _singletonM04D20di36_Clock; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.IService Root @@ -131,52 +131,54 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - System.Func transientM04D13di1_Func = dependencyId => + System.Func transientM04D20di1_Func = dependencyId => { - int transientM04D13di3_Int32 = dependencyId; - if (_rootM04D13di._singletonM04D13di36_Clock == null) + int transientM04D20di3_Int32 = dependencyId; + if (_rootM04D20di._singletonM04D20di36_Clock == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Clock == null) + if (_rootM04D20di._singletonM04D20di36_Clock == null) { - _singletonM04D13di36_Clock = new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Clock(); - _rootM04D13di._singletonM04D13di36_Clock = _singletonM04D13di36_Clock; + _singletonM04D20di36_Clock = new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Clock(); + _rootM04D20di._singletonM04D20di36_Clock = _singletonM04D20di36_Clock; } } } - var dependency_M04D13di1 = new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Dependency(_rootM04D13di._singletonM04D13di36_Clock, transientM04D13di3_Int32); - return dependency_M04D13di1; + var dependency_M04D20di1 = new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Dependency(_rootM04D20di._singletonM04D20di36_Clock, transientM04D20di3_Int32); + return dependency_M04D20di1; }; - return new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Service(transientM04D13di1_Func); + return new Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.Service(transientM04D20di1_Func); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -189,18 +191,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -247,25 +249,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -278,7 +280,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.FuncWithArgumentsScenario.IService Resolve(Composition composition) { diff --git a/readme/func-with-tag.md b/readme/func-with-tag.md index d39c16796..69095f716 100644 --- a/readme/func-with-tag.md +++ b/readme/func-with-tag.md @@ -74,19 +74,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.BCL.FuncWithTagScenario.IService Root @@ -94,43 +94,45 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var perResolveM04D13di39_Func = default(System.Func); - perResolveM04D13di39_Func = new global::System.Func( + var perResolveM04D20di39_Func = default(System.Func); + perResolveM04D20di39_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M04D13di1 = new Pure.DI.UsageTests.BCL.FuncWithTagScenario.Dependency(); - return factory_M04D13di1; + var value_M04D20di1 = new Pure.DI.UsageTests.BCL.FuncWithTagScenario.Dependency(); + return value_M04D20di1; }); - return new Pure.DI.UsageTests.BCL.FuncWithTagScenario.Service(perResolveM04D13di39_Func); + return new Pure.DI.UsageTests.BCL.FuncWithTagScenario.Service(perResolveM04D20di39_Func); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -143,18 +145,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -195,25 +197,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : \"my tag\" IDependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncWithTagScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncWithTagScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -226,7 +228,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.FuncWithTagScenario.IService Resolve(Composition composition) { diff --git a/readme/func.md b/readme/func.md index 5d4f8fa4d..c41265780 100644 --- a/readme/func.md +++ b/readme/func.md @@ -77,19 +77,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.BCL.FuncScenario.IService Root @@ -97,43 +97,45 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var perResolveM04D13di39_Func = default(System.Func); - perResolveM04D13di39_Func = new global::System.Func( + var perResolveM04D20di39_Func = default(System.Func); + perResolveM04D20di39_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M04D13di1 = new Pure.DI.UsageTests.BCL.FuncScenario.Dependency(); - return factory_M04D13di1; + var value_M04D20di1 = new Pure.DI.UsageTests.BCL.FuncScenario.Dependency(); + return value_M04D20di1; }); - return new Pure.DI.UsageTests.BCL.FuncScenario.Service(perResolveM04D13di39_Func); + return new Pure.DI.UsageTests.BCL.FuncScenario.Service(perResolveM04D20di39_Func); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -146,18 +148,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -198,25 +200,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.FuncScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -229,7 +231,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.FuncScenario.IService Resolve(Composition composition) { diff --git a/readme/generic-composition-roots-with-constraints.md b/readme/generic-composition-roots-with-constraints.md index 80d3e2aaa..c01d73d0c 100644 --- a/readme/generic-composition-roots-with-constraints.md +++ b/readme/generic-composition-roots-with-constraints.md @@ -95,16 +95,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] @@ -119,12 +119,12 @@ partial class Composition public Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.IService GetOtherService() where T: System.IDisposable { - Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.OtherService transientM04D13di0_OtherService; + Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.OtherService transientM04D20di0_OtherService; { - var dependency_M04D13di1 = new Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.Dependency(); - transientM04D13di0_OtherService = new OtherService(dependency_M04D13di1); + var dependency_M04D20di1 = new Pure.DI.UsageTests.Generics.GenericCompositionRootsWithConstraintsScenario.Dependency(); + transientM04D20di0_OtherService = new OtherService(dependency_M04D20di1); } - return transientM04D13di0_OtherService; + return transientM04D20di0_OtherService; } public override string ToString() diff --git a/readme/generic-composition-roots.md b/readme/generic-composition-roots.md index 3c7ed11ba..43790ded2 100644 --- a/readme/generic-composition-roots.md +++ b/readme/generic-composition-roots.md @@ -89,16 +89,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] @@ -110,12 +110,12 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.IService GetOtherService() { - Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.OtherService transientM04D13di0_OtherService; + Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.OtherService transientM04D20di0_OtherService; { - var dependency_M04D13di1 = new Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.Dependency(); - transientM04D13di0_OtherService = new OtherService(dependency_M04D13di1); + var dependency_M04D20di1 = new Pure.DI.UsageTests.Generics.GenericsCompositionRootsScenario.Dependency(); + transientM04D20di0_OtherService = new OtherService(dependency_M04D20di1); } - return transientM04D13di0_OtherService; + return transientM04D20di0_OtherService; } public override string ToString() diff --git a/readme/generics.md b/readme/generics.md index 0ef3dcde4..6b2c3d641 100644 --- a/readme/generics.md +++ b/readme/generics.md @@ -96,16 +96,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Generics.GenericsScenario.IService Root @@ -117,31 +117,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -154,18 +156,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -212,25 +214,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Generics.GenericsScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Generics.GenericsScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -243,7 +245,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Generics.GenericsScenario.IService Resolve(Composition composition) { diff --git a/readme/injection.md b/readme/injection.md index 55ca350c3..d44de2dd6 100644 --- a/readme/injection.md +++ b/readme/injection.md @@ -73,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.InjectionScenario.IService Root @@ -90,40 +90,42 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.Basics.InjectionScenario.Service transientM04D13di0_Service; + Pure.DI.UsageTests.Basics.InjectionScenario.Service transientM04D20di0_Service; { - var dependency_M04D13di1 = new Pure.DI.UsageTests.Basics.InjectionScenario.Dependency(); - transientM04D13di0_Service = new Service(dependency_M04D13di1); + var dependency_M04D20di1 = new Pure.DI.UsageTests.Basics.InjectionScenario.Dependency(); + transientM04D20di0_Service = new Service(dependency_M04D20di1); } - return transientM04D13di0_Service; + return transientM04D20di0_Service; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -136,18 +138,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -184,25 +186,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.InjectionScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.InjectionScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -215,7 +217,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.InjectionScenario.IService Resolve(Composition composition) { diff --git a/readme/injections-of-abstractions.md b/readme/injections-of-abstractions.md index d11563383..0e169a475 100644 --- a/readme/injections-of-abstractions.md +++ b/readme/injections-of-abstractions.md @@ -79,16 +79,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.InjectionsOfAbstractionsScenario.Program Root diff --git a/readme/instance-initialization.md b/readme/instance-initialization.md index 1464d5f15..683f56c62 100644 --- a/readme/instance-initialization.md +++ b/readme/instance-initialization.md @@ -89,24 +89,24 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly string _argM04D13di_serviceName; + private readonly Composition _rootM04D20di; + private readonly string _argM04D20di_serviceName; public Composition(string serviceName) { - _rootM04D13di = this; + _rootM04D20di = this; if (ReferenceEquals(serviceName, null)) { throw new global::System.ArgumentNullException("serviceName"); } - _argM04D13di_serviceName = serviceName; + _argM04D20di_serviceName = serviceName; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _argM04D13di_serviceName = baseComposition._argM04D13di_serviceName; + _rootM04D20di = baseComposition._rootM04D20di; + _argM04D20di_serviceName = baseComposition._argM04D20di_serviceName; } public Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.IService Root @@ -114,41 +114,43 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Service transientM04D13di0_Service; + Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Service transientM04D20di0_Service; { - var service_M04D13di1 = new Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Service(_argM04D13di_serviceName, new Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Dependency()); - service_M04D13di1.Initialize(); - transientM04D13di0_Service = service_M04D13di1; + var service_M04D20di1 = new Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Service(_argM04D20di_serviceName, new Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.Dependency()); + service_M04D20di1.Initialize(); + transientM04D20di0_Service = service_M04D20di1; } - return transientM04D13di0_Service; + return transientM04D20di0_Service; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -161,18 +163,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -209,25 +211,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -240,7 +242,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.InstanceInitializationScenario.IService Resolve(Composition composition) { diff --git a/readme/interception.md b/readme/interception.md index d2e286707..117ff8f7a 100644 --- a/readme/interception.md +++ b/readme/interception.md @@ -83,16 +83,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Interception.InterceptionScenario.IService Root @@ -104,31 +104,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -141,18 +143,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -185,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.InterceptionScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Interception.InterceptionScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -216,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Interception.InterceptionScenario.IService Resolve(Composition composition) { diff --git a/readme/keyed-service-provider.md b/readme/keyed-service-provider.md index 987efd35e..075ded886 100644 --- a/readme/keyed-service-provider.md +++ b/readme/keyed-service-provider.md @@ -84,87 +84,89 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency _singletonM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency _singletonM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } - private Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency RootM04D13di0001 + private Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency RootM04D20di0001 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - return _rootM04D13di._singletonM04D13di36_Dependency; + return _rootM04D20di._singletonM04D20di36_Dependency; } } - private Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService RootM04D13di0002 + private Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService RootM04D20di0002 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - return new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Service(_rootM04D13di._singletonM04D13di36_Dependency); + return new Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.Service(_rootM04D20di._singletonM04D20di36_Dependency); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object GetService(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -177,18 +179,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object GetRequiredKeyedService(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -229,28 +231,28 @@ partial class Composition " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -263,7 +265,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency Resolve(Composition composition) { @@ -275,14 +277,14 @@ partial class Composition switch (tag) { case "Dependency Key": - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IDependency."); } } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService Resolve(Composition composition) { @@ -294,7 +296,7 @@ partial class Composition switch (tag) { case "Service Key": - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.KeyedServiceProviderScenario.IService."); } diff --git a/readme/lazy.md b/readme/lazy.md index 4bca2a701..b715622be 100644 --- a/readme/lazy.md +++ b/readme/lazy.md @@ -71,19 +71,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.BCL.LazyScenario.IService Root @@ -91,48 +91,50 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var perResolveM04D13di40_Func = default(System.Func); - perResolveM04D13di40_Func = new global::System.Func( + var perResolveM04D20di40_Func = default(System.Func); + perResolveM04D20di40_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M04D13di1 = new Pure.DI.UsageTests.BCL.LazyScenario.Dependency(); - return factory_M04D13di1; + var value_M04D20di1 = new Pure.DI.UsageTests.BCL.LazyScenario.Dependency(); + return value_M04D20di1; }); - System.Lazy transientM04D13di1_Lazy; + System.Lazy transientM04D20di1_Lazy; { - var factory_M04D13di2 = perResolveM04D13di40_Func; - transientM04D13di1_Lazy = new global::System.Lazy(factory_M04D13di2, true); + var factory_M04D20di2 = perResolveM04D20di40_Func; + transientM04D20di1_Lazy = new global::System.Lazy(factory_M04D20di2, true); } - return new Pure.DI.UsageTests.BCL.LazyScenario.Service(transientM04D13di1_Lazy); + return new Pure.DI.UsageTests.BCL.LazyScenario.Service(transientM04D20di1_Lazy); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -145,18 +147,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -199,25 +201,25 @@ partial class Composition " FuncᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.LazyScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.LazyScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -230,7 +232,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.LazyScenario.IService Resolve(Composition composition) { diff --git a/readme/manually-started-tasks.md b/readme/manually-started-tasks.md index af475e93a..b9579d374 100644 --- a/readme/manually-started-tasks.md +++ b/readme/manually-started-tasks.md @@ -111,39 +111,39 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public Pure.DI.UsageTests.BCL.ManualTaskScenario.IService GetRoot(System.Threading.CancellationToken cancellationToken) { - var perResolveM04D13di42_Func = default(System.Func); - perResolveM04D13di42_Func = new global::System.Func( + var perResolveM04D20di42_Func = default(System.Func); + perResolveM04D20di42_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M04D13di1 = new Pure.DI.UsageTests.BCL.ManualTaskScenario.Dependency(); - return factory_M04D13di1; + var value_M04D20di1 = new Pure.DI.UsageTests.BCL.ManualTaskScenario.Dependency(); + return value_M04D20di1; }); - System.Threading.Tasks.Task transientM04D13di1_Task; + System.Threading.Tasks.Task transientM04D20di1_Task; { - var factory_M04D13di2 = perResolveM04D13di42_Func; - var cancellationToken_M04D13di3 = cancellationToken; - transientM04D13di1_Task = new Task(factory_M04D13di2, cancellationToken_M04D13di3); + var factory_M04D20di2 = perResolveM04D20di42_Func; + var cancellationToken_M04D20di3 = cancellationToken; + transientM04D20di1_Task = new Task(factory_M04D20di2, cancellationToken_M04D20di3); } - return new Pure.DI.UsageTests.BCL.ManualTaskScenario.Service(transientM04D13di1_Task); + return new Pure.DI.UsageTests.BCL.ManualTaskScenario.Service(transientM04D20di1_Task); } public override string ToString() diff --git a/readme/member-ordinal-attribute.md b/readme/member-ordinal-attribute.md index 998a24a2b..0742c168c 100644 --- a/readme/member-ordinal-attribute.md +++ b/readme/member-ordinal-attribute.md @@ -100,30 +100,30 @@ classDiagram ```c# partial class PersonComposition { - private readonly PersonComposition _rootM04D13di; - private readonly int _argM04D13di_personId; - private readonly string _argM04D13di_personName; - private readonly System.DateTime _argM04D13di_personBirthday; + private readonly PersonComposition _rootM04D20di; + private readonly int _argM04D20di_personId; + private readonly string _argM04D20di_personName; + private readonly System.DateTime _argM04D20di_personBirthday; public PersonComposition(int personId, string personName, System.DateTime personBirthday) { - _rootM04D13di = this; + _rootM04D20di = this; if (ReferenceEquals(personName, null)) { throw new global::System.ArgumentNullException("personName"); } - _argM04D13di_personId = personId; - _argM04D13di_personName = personName; - _argM04D13di_personBirthday = personBirthday; + _argM04D20di_personId = personId; + _argM04D20di_personName = personName; + _argM04D20di_personBirthday = personBirthday; } internal PersonComposition(PersonComposition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _argM04D13di_personId = baseComposition._argM04D13di_personId; - _argM04D13di_personName = baseComposition._argM04D13di_personName; - _argM04D13di_personBirthday = baseComposition._argM04D13di_personBirthday; + _rootM04D20di = baseComposition._rootM04D20di; + _argM04D20di_personId = baseComposition._argM04D20di_personId; + _argM04D20di_personName = baseComposition._argM04D20di_personName; + _argM04D20di_personBirthday = baseComposition._argM04D20di_personBirthday; } public Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.IPerson Person @@ -131,39 +131,41 @@ partial class PersonComposition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.Person transientM04D13di0_Person = new Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.Person(); - transientM04D13di0_Person.Id = _argM04D13di_personId; - transientM04D13di0_Person.FirstName = _argM04D13di_personName; - transientM04D13di0_Person.Birthday = _argM04D13di_personBirthday; - return transientM04D13di0_Person; + Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.Person transientM04D20di0_Person = new Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.Person(); + transientM04D20di0_Person.Id = _argM04D20di_personId; + transientM04D20di0_Person.FirstName = _argM04D20di_personName; + transientM04D20di0_Person.Birthday = _argM04D20di_personBirthday; + return transientM04D20di0_Person; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -176,18 +178,18 @@ partial class PersonComposition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -227,25 +229,25 @@ partial class PersonComposition " PersonComposition ..> Person : IPerson Person"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static PersonComposition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.IPerson), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.IPerson), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(PersonComposition composite) { @@ -258,7 +260,7 @@ partial class PersonComposition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Attributes.MemberOrdinalAttributeScenario.IPerson Resolve(PersonComposition composition) { diff --git a/readme/method-injection.md b/readme/method-injection.md index f659b060a..d02a8c7aa 100644 --- a/readme/method-injection.md +++ b/readme/method-injection.md @@ -74,16 +74,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.MethodInjectionScenario.IService Root @@ -91,37 +91,39 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.Basics.MethodInjectionScenario.Service transientM04D13di0_Service = new Pure.DI.UsageTests.Basics.MethodInjectionScenario.Service(); - transientM04D13di0_Service.SetDependency(new Pure.DI.UsageTests.Basics.MethodInjectionScenario.Dependency()); - return transientM04D13di0_Service; + Pure.DI.UsageTests.Basics.MethodInjectionScenario.Service transientM04D20di0_Service = new Pure.DI.UsageTests.Basics.MethodInjectionScenario.Service(); + transientM04D20di0_Service.SetDependency(new Pure.DI.UsageTests.Basics.MethodInjectionScenario.Dependency()); + return transientM04D20di0_Service; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -134,18 +136,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -185,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.MethodInjectionScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.MethodInjectionScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -216,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.MethodInjectionScenario.IService Resolve(Composition composition) { diff --git a/readme/multi-contract-bindings.md b/readme/multi-contract-bindings.md index 48ccdf4e9..8526f0d78 100644 --- a/readme/multi-contract-bindings.md +++ b/readme/multi-contract-bindings.md @@ -74,16 +74,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.MultiContractBindingsScenario.IService Root @@ -95,31 +95,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -132,18 +134,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -187,25 +189,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.MultiContractBindingsScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.MultiContractBindingsScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -218,7 +220,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.MultiContractBindingsScenario.IService Resolve(Composition composition) { diff --git a/readme/oncannotresolve-hint.md b/readme/oncannotresolve-hint.md index 983292eb2..ba4c97ebe 100644 --- a/readme/oncannotresolve-hint.md +++ b/readme/oncannotresolve-hint.md @@ -96,16 +96,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.IService Root @@ -113,36 +113,38 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - string transientM04D13di2_String = OnCannotResolve(null, Pure.DI.Lifetime.Transient); - return new Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.Service(new Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.Dependency(transientM04D13di2_String)); + string transientM04D20di2_String = OnCannotResolve(null, Pure.DI.Lifetime.Transient); + return new Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.Service(new Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.Dependency(transientM04D20di2_String)); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -155,18 +157,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -209,25 +211,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -240,7 +242,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.OnCannotResolveHintScenario.IService Resolve(Composition composition) { diff --git a/readme/ondependencyinjection-hint.md b/readme/ondependencyinjection-hint.md index e6bd481a0..25fa34884 100644 --- a/readme/ondependencyinjection-hint.md +++ b/readme/ondependencyinjection-hint.md @@ -93,16 +93,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario.IService Root @@ -114,31 +114,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -151,18 +153,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -203,25 +205,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -234,7 +236,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.OnDependencyInjectionHintScenario.IService Resolve(Composition composition) { diff --git a/readme/onnewinstance-hint.md b/readme/onnewinstance-hint.md index 5cfc656cc..2b25af2f4 100644 --- a/readme/onnewinstance-hint.md +++ b/readme/onnewinstance-hint.md @@ -95,20 +95,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency _singletonM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency _singletonM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.IService Root @@ -116,52 +116,54 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency _singletonM04D13di36_DependencyTemp; - _singletonM04D13di36_DependencyTemp = new Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency(); - OnNewInstance(ref _singletonM04D13di36_DependencyTemp, null, Pure.DI.Lifetime.Singleton); + Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency _singletonM04D20di36_DependencyTemp; + _singletonM04D20di36_DependencyTemp = new Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Dependency(); + OnNewInstance(ref _singletonM04D20di36_DependencyTemp, null, Pure.DI.Lifetime.Singleton); global::System.Threading.Thread.MemoryBarrier(); - _singletonM04D13di36_Dependency = _singletonM04D13di36_DependencyTemp; - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = _singletonM04D20di36_DependencyTemp; + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Service transientM04D13di0_Service = new Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Service(_rootM04D13di._singletonM04D13di36_Dependency); - OnNewInstance(ref transientM04D13di0_Service, null, Pure.DI.Lifetime.Transient); - return transientM04D13di0_Service; + Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Service transientM04D20di0_Service = new Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.Service(_rootM04D20di._singletonM04D20di36_Dependency); + OnNewInstance(ref transientM04D20di0_Service, null, Pure.DI.Lifetime.Transient); + return transientM04D20di0_Service; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -174,18 +176,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -226,25 +228,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -257,7 +259,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.OnNewInstanceHintScenario.IService Resolve(Composition composition) { diff --git a/readme/overriding-the-bcl-binding.md b/readme/overriding-the-bcl-binding.md index 0205aee61..aa516ce83 100644 --- a/readme/overriding-the-bcl-binding.md +++ b/readme/overriding-the-bcl-binding.md @@ -73,16 +73,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IService Root @@ -90,41 +90,43 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IDependency[] transientM04D13di1_ = new IDependency[] + Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IDependency[] transientM04D20di1_ = new IDependency[] { new AbcDependency(), new XyzDependency(), new AbcDependency() }; - return new Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.Service(transientM04D13di1_); + return new Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.Service(transientM04D20di1_); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -137,18 +139,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -181,25 +183,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -212,7 +214,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.OverridingBclBindingScenario.IService Resolve(Composition composition) { diff --git a/readme/partial-class.md b/readme/partial-class.md index 08fc6f297..630f12258 100644 --- a/readme/partial-class.md +++ b/readme/partial-class.md @@ -104,16 +104,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } internal Pure.DI.UsageTests.Advanced.PartialClassScenario.Service Root @@ -121,38 +121,40 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - long transientM04D13di5_Int64 = GenerateId(); - long transientM04D13di4_Int64 = GenerateId(); - string transientM04D13di1_String = $"{_serviceName}_{GenerateId()}"; - return new Pure.DI.UsageTests.Advanced.PartialClassScenario.Service(transientM04D13di1_String, new Pure.DI.UsageTests.Advanced.PartialClassScenario.Dependency(transientM04D13di5_Int64), new Pure.DI.UsageTests.Advanced.PartialClassScenario.Dependency(transientM04D13di4_Int64)); + long transientM04D20di5_Int64 = GenerateId(); + long transientM04D20di4_Int64 = GenerateId(); + string transientM04D20di1_String = $"{_serviceName}_{GenerateId()}"; + return new Pure.DI.UsageTests.Advanced.PartialClassScenario.Service(transientM04D20di1_String, new Pure.DI.UsageTests.Advanced.PartialClassScenario.Dependency(transientM04D20di5_Int64), new Pure.DI.UsageTests.Advanced.PartialClassScenario.Dependency(transientM04D20di4_Int64)); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -165,18 +167,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -216,25 +218,25 @@ partial class Composition " Composition ..> Service : Service Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.PartialClassScenario.Service), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.PartialClassScenario.Service), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -247,7 +249,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.PartialClassScenario.Service Resolve(Composition composition) { diff --git a/readme/perblock.md b/readme/perblock.md index 2eb6ee614..334a76a2d 100644 --- a/readme/perblock.md +++ b/readme/perblock.md @@ -85,19 +85,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service Root @@ -105,50 +105,52 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var perResolveM04D13di43_Func = default(System.Func<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>); - perResolveM04D13di43_Func = new global::System.Func<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>( + var perResolveM04D20di43_Func = default(System.Func<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>); + perResolveM04D20di43_Func = new global::System.Func<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency perBlockM04D13di4_Dependency = new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency(); - var factory_M04D13di1 = (perBlockM04D13di4_Dependency, perBlockM04D13di4_Dependency); - return factory_M04D13di1; + Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency perBlockM04D20di4_Dependency = new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency(); + var value_M04D20di1 = (perBlockM04D20di4_Dependency, perBlockM04D20di4_Dependency); + return value_M04D20di1; }); - System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)> transientM04D13di2_Lazy; + System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)> transientM04D20di2_Lazy; { - var factory_M04D13di2 = perResolveM04D13di43_Func; - transientM04D13di2_Lazy = new global::System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>(factory_M04D13di2, true); + var factory_M04D20di2 = perResolveM04D20di43_Func; + transientM04D20di2_Lazy = new global::System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerBlockScenario.IDependency dep4)>(factory_M04D20di2, true); } - Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency perBlockM04D13di1_Dependency = new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency(); - return new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service(perBlockM04D13di1_Dependency, perBlockM04D13di1_Dependency, transientM04D13di2_Lazy); + Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency perBlockM04D20di1_Dependency = new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Dependency(); + return new Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service(perBlockM04D20di1_Dependency, perBlockM04D20di1_Dependency, transientM04D20di2_Lazy); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -161,18 +163,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -218,25 +220,25 @@ partial class Composition " FuncᐸValueTupleᐸIDependencyˏIDependencyᐳᐳ *-- ValueTupleᐸIDependencyˏIDependencyᐳ : ValueTupleᐸIDependencyˏIDependencyᐳ"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -249,7 +251,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.PerBlockScenario.Service Resolve(Composition composition) { diff --git a/readme/perresolve.md b/readme/perresolve.md index 122e4fb4f..88dc1cb86 100644 --- a/readme/perresolve.md +++ b/readme/perresolve.md @@ -85,19 +85,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service Root @@ -105,69 +105,71 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var perResolveM04D13di36_Dependency = default(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency); - var perResolveM04D13di43_Func = default(System.Func<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>); - perResolveM04D13di43_Func = new global::System.Func<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>( + var perResolveM04D20di36_Dependency = default(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency); + var perResolveM04D20di43_Func = default(System.Func<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>); + perResolveM04D20di43_Func = new global::System.Func<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - if (perResolveM04D13di36_Dependency == null) + if (perResolveM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (perResolveM04D13di36_Dependency == null) + if (perResolveM04D20di36_Dependency == null) { - perResolveM04D13di36_Dependency = new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency(); + perResolveM04D20di36_Dependency = new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency(); } } } - var factory_M04D13di1 = (perResolveM04D13di36_Dependency, perResolveM04D13di36_Dependency); - return factory_M04D13di1; + var value_M04D20di1 = (perResolveM04D20di36_Dependency, perResolveM04D20di36_Dependency); + return value_M04D20di1; }); - System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)> transientM04D13di1_Lazy; + System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)> transientM04D20di1_Lazy; { - var factory_M04D13di2 = perResolveM04D13di43_Func; - transientM04D13di1_Lazy = new global::System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>(factory_M04D13di2, true); + var factory_M04D20di2 = perResolveM04D20di43_Func; + transientM04D20di1_Lazy = new global::System.Lazy<(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep3, Pure.DI.UsageTests.Lifetimes.PerResolveScenario.IDependency dep4)>(factory_M04D20di2, true); } - if (perResolveM04D13di36_Dependency == null) + if (perResolveM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (perResolveM04D13di36_Dependency == null) + if (perResolveM04D20di36_Dependency == null) { - perResolveM04D13di36_Dependency = new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency(); + perResolveM04D20di36_Dependency = new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Dependency(); } } } - return new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service(perResolveM04D13di36_Dependency, perResolveM04D13di36_Dependency, transientM04D13di1_Lazy); + return new Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service(perResolveM04D20di36_Dependency, perResolveM04D20di36_Dependency, transientM04D20di1_Lazy); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -180,18 +182,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -237,25 +239,25 @@ partial class Composition " FuncᐸValueTupleᐸIDependencyˏIDependencyᐳᐳ *-- ValueTupleᐸIDependencyˏIDependencyᐳ : ValueTupleᐸIDependencyˏIDependencyᐳ"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -268,7 +270,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.PerResolveScenario.Service Resolve(Composition composition) { diff --git a/readme/property-injection.md b/readme/property-injection.md index fe5eefb7f..2ce4de716 100644 --- a/readme/property-injection.md +++ b/readme/property-injection.md @@ -71,16 +71,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.PropertyInjectionScenario.IService Root @@ -88,37 +88,39 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Service transientM04D13di0_Service = new Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Service(); - transientM04D13di0_Service.Dependency = new Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Dependency(); - return transientM04D13di0_Service; + Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Service transientM04D20di0_Service = new Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Service(); + transientM04D20di0_Service.Dependency = new Pure.DI.UsageTests.Basics.PropertyInjectionScenario.Dependency(); + return transientM04D20di0_Service; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -131,18 +133,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -182,25 +184,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.PropertyInjectionScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.PropertyInjectionScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -213,7 +215,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.PropertyInjectionScenario.IService Resolve(Composition composition) { diff --git a/readme/required-properties-or-fields.md b/readme/required-properties-or-fields.md index 3274c1e1b..a32c2dad9 100644 --- a/readme/required-properties-or-fields.md +++ b/readme/required-properties-or-fields.md @@ -81,24 +81,24 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly string _argM04D13di_name; + private readonly Composition _rootM04D20di; + private readonly string _argM04D20di_name; public Composition(string name) { - _rootM04D13di = this; + _rootM04D20di = this; if (ReferenceEquals(name, null)) { throw new global::System.ArgumentNullException("name"); } - _argM04D13di_name = name; + _argM04D20di_name = name; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _argM04D13di_name = baseComposition._argM04D13di_name; + _rootM04D20di = baseComposition._rootM04D20di; + _argM04D20di_name = baseComposition._argM04D20di_name; } public Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.IService Root @@ -108,37 +108,39 @@ partial class Composition { return new Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.Service() { - ServiceNameField = _argM04D13di_name, + ServiceNameField = _argM04D20di_name, Dependency = new Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.Dependency() }; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -151,18 +153,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -205,25 +207,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -236,7 +238,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.RequiredPropertiesOrFieldsScenario.IService Resolve(Composition composition) { diff --git a/readme/resolve-hint.md b/readme/resolve-hint.md index fa84afdfa..9ebe5d24d 100644 --- a/readme/resolve-hint.md +++ b/readme/resolve-hint.md @@ -64,16 +64,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Hints.ResolveHintScenario.IDependency DependencyRoot diff --git a/readme/resolve-methods.md b/readme/resolve-methods.md index 325b26b9e..b3ef9f356 100644 --- a/readme/resolve-methods.md +++ b/readme/resolve-methods.md @@ -88,16 +88,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.ResolveScenario.IService OtherService @@ -109,7 +109,7 @@ partial class Composition } } - private Pure.DI.UsageTests.Basics.ResolveScenario.IDependency RootM04D13di0001 + private Pure.DI.UsageTests.Basics.ResolveScenario.IDependency RootM04D20di0001 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get @@ -118,7 +118,7 @@ partial class Composition } } - private Pure.DI.UsageTests.Basics.ResolveScenario.IService RootM04D13di0002 + private Pure.DI.UsageTests.Basics.ResolveScenario.IService RootM04D20di0002 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get @@ -127,31 +127,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -164,18 +166,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -222,28 +224,28 @@ partial class Composition " Composition ..> OtherService : IService OtherService"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ResolveScenario.IService), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ResolveScenario.IDependency), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ResolveScenario.IService), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.ResolveScenario.IDependency), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -256,11 +258,11 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.ResolveScenario.IService Resolve(Composition composition) { - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; } public Pure.DI.UsageTests.Basics.ResolveScenario.IService ResolveByTag(Composition composition, object tag) @@ -270,18 +272,18 @@ partial class Composition case "Other": return composition.OtherService; case null: - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Basics.ResolveScenario.IService."); } } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.ResolveScenario.IDependency Resolve(Composition composition) { - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; } public Pure.DI.UsageTests.Basics.ResolveScenario.IDependency ResolveByTag(Composition composition, object tag) @@ -289,7 +291,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.Basics.ResolveScenario.IDependency."); } diff --git a/readme/root-arguments.md b/readme/root-arguments.md index 3304cb163..cf8b62e0b 100644 --- a/readme/root-arguments.md +++ b/readme/root-arguments.md @@ -104,16 +104,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] diff --git a/readme/rootbind.md b/readme/rootbind.md index 130c5e905..d16830d05 100644 --- a/readme/rootbind.md +++ b/readme/rootbind.md @@ -46,16 +46,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.RootBindScenario.IService Root @@ -67,31 +67,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -104,18 +106,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -146,25 +148,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.RootBindScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.RootBindScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -177,7 +179,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.RootBindScenario.IService Resolve(Composition composition) { diff --git a/readme/scope.md b/readme/scope.md index 21758326f..4f162d926 100644 --- a/readme/scope.md +++ b/readme/scope.md @@ -91,7 +91,6 @@ classDiagram + object Resolve(Type type, object? tag) } Composition --|> IDisposable - class Composition class Session { +Session(Composition composition) } @@ -106,6 +105,7 @@ classDiagram class Service { +Service(IDependency dependency) } + class Composition class FuncᐸSessionᐳ class IDependency { <> @@ -129,24 +129,24 @@ classDiagram ```c# partial class Composition: global::System.IDisposable { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private readonly global::System.IDisposable[] _disposablesM04D13di; - private int _disposeIndexM04D13di; - private Pure.DI.UsageTests.Lifetimes.ScopeScenario.Dependency _scopedM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private readonly global::System.IDisposable[] _disposablesM04D20di; + private int _disposeIndexM04D20di; + private Pure.DI.UsageTests.Lifetimes.ScopeScenario.Dependency _scopedM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); - _disposablesM04D13di = new global::System.IDisposable[1]; + _rootM04D20di = this; + _lockM04D20di = new object(); + _disposablesM04D20di = new global::System.IDisposable[1]; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; - _disposablesM04D13di = new global::System.IDisposable[1]; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; + _disposablesM04D20di = new global::System.IDisposable[1]; } public Pure.DI.UsageTests.Lifetimes.ScopeScenario.IService SessionRoot @@ -154,18 +154,18 @@ partial class Composition: global::System.IDisposable [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_scopedM04D13di36_Dependency == null) + if (_scopedM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_scopedM04D13di36_Dependency == null) + if (_scopedM04D20di36_Dependency == null) { - _scopedM04D13di36_Dependency = new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Dependency(); - _disposablesM04D13di[_disposeIndexM04D13di++] = _scopedM04D13di36_Dependency; + _scopedM04D20di36_Dependency = new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Dependency(); + _disposablesM04D20di[_disposeIndexM04D20di++] = _scopedM04D20di36_Dependency; } } } - return new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Service(_scopedM04D13di36_Dependency); + return new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Service(_scopedM04D20di36_Dependency); } } @@ -174,44 +174,46 @@ partial class Composition: global::System.IDisposable [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var perResolveM04D13di43_Func = default(System.Func); - perResolveM04D13di43_Func = new global::System.Func( + var perResolveM04D20di43_Func = default(System.Func); + perResolveM04D20di43_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - Pure.DI.UsageTests.Lifetimes.ScopeScenario.Composition transientM04D13di2_Composition = this; - var factory_M04D13di1 = new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Session(transientM04D13di2_Composition); - return factory_M04D13di1; + Pure.DI.UsageTests.Lifetimes.ScopeScenario.Composition transientM04D20di2_Composition = this; + var value_M04D20di1 = new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Session(transientM04D20di2_Composition); + return value_M04D20di1; }); - return new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program(perResolveM04D13di43_Func); + return new Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program(perResolveM04D20di43_Func); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -224,18 +226,18 @@ partial class Composition: global::System.IDisposable [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -248,11 +250,11 @@ partial class Composition: global::System.IDisposable public void Dispose() { - lock (_lockM04D13di) + lock (_lockM04D20di) { - while (_disposeIndexM04D13di > 0) + while (_disposeIndexM04D20di > 0) { - var disposableInstance = _disposablesM04D13di[--_disposeIndexM04D13di]; + var disposableInstance = _disposablesM04D20di[--_disposeIndexM04D20di]; try { disposableInstance.Dispose(); @@ -263,7 +265,7 @@ partial class Composition: global::System.IDisposable } } - _scopedM04D13di36_Dependency = null; + _scopedM04D20di36_Dependency = null; } } @@ -282,7 +284,6 @@ partial class Composition: global::System.IDisposable " + object Resolve(Type type, object? tag)\n" + " }\n" + " Composition --|> IDisposable\n" + - " class Composition\n" + " class Session {\n" + " +Session(Composition composition)\n" + " }\n" + @@ -297,6 +298,7 @@ partial class Composition: global::System.IDisposable " class Service {\n" + " +Service(IDependency dependency)\n" + " }\n" + + " class Composition\n" + " class FuncᐸSessionᐳ\n" + " class IDependency {\n" + " <>\n" + @@ -312,28 +314,28 @@ partial class Composition: global::System.IDisposable " FuncᐸSessionᐳ *-- Session : Session"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.ScopeScenario.IService), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.ScopeScenario.IService), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -346,7 +348,7 @@ partial class Composition: global::System.IDisposable } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.ScopeScenario.IService Resolve(Composition composition) { @@ -365,7 +367,7 @@ partial class Composition: global::System.IDisposable } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.ScopeScenario.Program Resolve(Composition composition) { diff --git a/readme/service-collection.md b/readme/service-collection.md index ab049d77e..55af9120f 100644 --- a/readme/service-collection.md +++ b/readme/service-collection.md @@ -81,87 +81,89 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency _singletonM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency _singletonM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } - private Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency RootM04D13di0001 + private Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency RootM04D20di0001 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - return _rootM04D13di._singletonM04D13di36_Dependency; + return _rootM04D20di._singletonM04D20di36_Dependency; } } - private Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService RootM04D13di0002 + private Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService RootM04D20di0002 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - return new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Service(_rootM04D13di._singletonM04D13di36_Dependency); + return new Pure.DI.UsageTests.BCL.ServiceCollectionScenario.Service(_rootM04D20di._singletonM04D20di36_Dependency); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -174,18 +176,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -226,30 +228,30 @@ partial class Composition " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - OnNewRoot(valResolverM04D13di_0000, "RootM04D13di0001", "Dependency Key", Pure.DI.Lifetime.Singleton); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - OnNewRoot(valResolverM04D13di_0001, "RootM04D13di0002", null, Pure.DI.Lifetime.Transient); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + OnNewRoot(valResolverM04D20di_0000, "RootM04D20di0001", "Dependency Key", Pure.DI.Lifetime.Singleton); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + OnNewRoot(valResolverM04D20di_0001, "RootM04D20di0002", null, Pure.DI.Lifetime.Transient); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -262,7 +264,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency Resolve(Composition composition) { @@ -274,18 +276,18 @@ partial class Composition switch (tag) { case "Dependency Key": - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IDependency."); } } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService Resolve(Composition composition) { - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; } public Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService ResolveByTag(Composition composition, object tag) @@ -293,7 +295,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceCollectionScenario.IService."); } diff --git a/readme/service-provider-with-scope.md b/readme/service-provider-with-scope.md index 2eacf5fe2..910ea9743 100644 --- a/readme/service-provider-with-scope.md +++ b/readme/service-provider-with-scope.md @@ -110,97 +110,99 @@ classDiagram ```c# partial class Composition: global::System.IDisposable { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private readonly global::System.IDisposable[] _disposablesM04D13di; - private int _disposeIndexM04D13di; - private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency _singletonM04D13di36_Dependency; - private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Service _scopedM04D13di37_Service; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private readonly global::System.IDisposable[] _disposablesM04D20di; + private int _disposeIndexM04D20di; + private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency _singletonM04D20di36_Dependency; + private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Service _scopedM04D20di37_Service; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); - _disposablesM04D13di = new global::System.IDisposable[1]; + _rootM04D20di = this; + _lockM04D20di = new object(); + _disposablesM04D20di = new global::System.IDisposable[1]; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; - _disposablesM04D13di = new global::System.IDisposable[1]; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; + _disposablesM04D20di = new global::System.IDisposable[1]; } - private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency RootM04D13di0001 + private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency RootM04D20di0001 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - return _rootM04D13di._singletonM04D13di36_Dependency; + return _rootM04D20di._singletonM04D20di36_Dependency; } } - private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService RootM04D13di0002 + private Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService RootM04D20di0002 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_scopedM04D13di37_Service == null) + if (_scopedM04D20di37_Service == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_scopedM04D13di37_Service == null) + if (_scopedM04D20di37_Service == null) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } - _scopedM04D13di37_Service = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Service(_rootM04D13di._singletonM04D13di36_Dependency); - _disposablesM04D13di[_disposeIndexM04D13di++] = _scopedM04D13di37_Service; + _scopedM04D20di37_Service = new Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.Service(_rootM04D20di._singletonM04D20di36_Dependency); + _disposablesM04D20di[_disposeIndexM04D20di++] = _scopedM04D20di37_Service; } } } - return _scopedM04D13di37_Service; + return _scopedM04D20di37_Service; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object GetService(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -213,18 +215,18 @@ partial class Composition: global::System.IDisposable [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object GetRequiredKeyedService(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -237,11 +239,11 @@ partial class Composition: global::System.IDisposable public void Dispose() { - lock (_lockM04D13di) + lock (_lockM04D20di) { - while (_disposeIndexM04D13di > 0) + while (_disposeIndexM04D20di > 0) { - var disposableInstance = _disposablesM04D13di[--_disposeIndexM04D13di]; + var disposableInstance = _disposablesM04D20di[--_disposeIndexM04D20di]; try { disposableInstance.Dispose(); @@ -252,8 +254,8 @@ partial class Composition: global::System.IDisposable } } - _singletonM04D13di36_Dependency = null; - _scopedM04D13di37_Service = null; + _singletonM04D20di36_Dependency = null; + _scopedM04D20di37_Service = null; } } @@ -291,28 +293,28 @@ partial class Composition: global::System.IDisposable " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -325,11 +327,11 @@ partial class Composition: global::System.IDisposable } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency Resolve(Composition composition) { - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; } public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency ResolveByTag(Composition composition, object tag) @@ -337,18 +339,18 @@ partial class Composition: global::System.IDisposable switch (tag) { case null: - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IDependency."); } } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService Resolve(Composition composition) { - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; } public Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService ResolveByTag(Composition composition, object tag) @@ -356,7 +358,7 @@ partial class Composition: global::System.IDisposable switch (tag) { case null: - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceProviderWithScopeScenario.IService."); } diff --git a/readme/service-provider.md b/readme/service-provider.md index 7f6c3bf01..36b9dbaa2 100644 --- a/readme/service-provider.md +++ b/readme/service-provider.md @@ -79,87 +79,89 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency _singletonM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency _singletonM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } - private Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency RootM04D13di0001 + private Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency RootM04D20di0001 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - return _rootM04D13di._singletonM04D13di36_Dependency; + return _rootM04D20di._singletonM04D20di36_Dependency; } } - private Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService RootM04D13di0002 + private Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService RootM04D20di0002 { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - return new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Service(_rootM04D13di._singletonM04D13di36_Dependency); + return new Pure.DI.UsageTests.BCL.ServiceProviderScenario.Service(_rootM04D20di._singletonM04D20di36_Dependency); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object GetService(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -172,18 +174,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -224,28 +226,28 @@ partial class Composition " Composition ..> Service : IService _"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -258,11 +260,11 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency Resolve(Composition composition) { - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; } public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency ResolveByTag(Composition composition, object tag) @@ -270,18 +272,18 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D13di0001; + return composition.RootM04D20di0001; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceProviderScenario.IDependency."); } } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService Resolve(Composition composition) { - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; } public Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService ResolveByTag(Composition composition, object tag) @@ -289,7 +291,7 @@ partial class Composition switch (tag) { case null: - return composition.RootM04D13di0002; + return composition.RootM04D20di0002; default: throw new global::System.InvalidOperationException($"Cannot resolve composition root \"{tag}\" of type Pure.DI.UsageTests.BCL.ServiceProviderScenario.IService."); } diff --git a/readme/simplified-binding.md b/readme/simplified-binding.md index 38246e469..c922c1165 100644 --- a/readme/simplified-binding.md +++ b/readme/simplified-binding.md @@ -88,16 +88,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Service MyService @@ -105,8 +105,8 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Dependency perBlockM04D13di1_Dependency = new Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Dependency(); - return new Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Service(perBlockM04D13di1_Dependency, perBlockM04D13di1_Dependency, perBlockM04D13di1_Dependency); + Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Dependency perBlockM04D20di1_Dependency = new Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Dependency(); + return new Pure.DI.UsageTests.Basics.SimplifiedBindingScenario.Service(perBlockM04D20di1_Dependency, perBlockM04D20di1_Dependency, perBlockM04D20di1_Dependency); } } diff --git a/readme/singleton.md b/readme/singleton.md index da94cac59..aa14bcce9 100644 --- a/readme/singleton.md +++ b/readme/singleton.md @@ -76,20 +76,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.Lifetimes.SingletonScenario.Dependency _singletonM04D13di36_Dependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.Lifetimes.SingletonScenario.Dependency _singletonM04D20di36_Dependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Lifetimes.SingletonScenario.IService Root @@ -97,46 +97,48 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di36_Dependency == null) + if (_rootM04D20di._singletonM04D20di36_Dependency == null) { - _singletonM04D13di36_Dependency = new Pure.DI.UsageTests.Lifetimes.SingletonScenario.Dependency(); - _rootM04D13di._singletonM04D13di36_Dependency = _singletonM04D13di36_Dependency; + _singletonM04D20di36_Dependency = new Pure.DI.UsageTests.Lifetimes.SingletonScenario.Dependency(); + _rootM04D20di._singletonM04D20di36_Dependency = _singletonM04D20di36_Dependency; } } } - return new Pure.DI.UsageTests.Lifetimes.SingletonScenario.Service(_singletonM04D13di36_Dependency, _rootM04D13di._singletonM04D13di36_Dependency); + return new Pure.DI.UsageTests.Lifetimes.SingletonScenario.Service(_singletonM04D20di36_Dependency, _rootM04D20di._singletonM04D20di36_Dependency); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -149,18 +151,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -200,25 +202,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.SingletonScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.SingletonScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -231,7 +233,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.SingletonScenario.IService Resolve(Composition composition) { diff --git a/readme/span-and-readonlyspan.md b/readme/span-and-readonlyspan.md index 1e77278f2..d20927406 100644 --- a/readme/span-and-readonlyspan.md +++ b/readme/span-and-readonlyspan.md @@ -55,7 +55,6 @@ classDiagram + object Resolve(Type type) + object Resolve(Type type, object? tag) } - class ReadOnlySpanᐸDependencyᐳ class Dependency { +Dependency() } @@ -63,14 +62,15 @@ classDiagram class Service { +Service(ReadOnlySpanᐸDependencyᐳ dependencies) } + class ReadOnlySpanᐸDependencyᐳ class IService { <> } + Service *-- ReadOnlySpanᐸDependencyᐳ : ReadOnlySpanᐸDependencyᐳ + Composition ..> Service : IService Root ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'a' Dependency ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'b' Dependency ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'c' Dependency - Service *-- ReadOnlySpanᐸDependencyᐳ : ReadOnlySpanᐸDependencyᐳ - Composition ..> Service : IService Root ``` @@ -81,16 +81,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.SpanScenario.IService Root @@ -98,41 +98,43 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - System.ReadOnlySpan transientM04D13di1_ReadOnlySpan = stackalloc Pure.DI.UsageTests.BCL.SpanScenario.Dependency[3] + System.ReadOnlySpan transientM04D20di1_ReadOnlySpan = stackalloc Pure.DI.UsageTests.BCL.SpanScenario.Dependency[3] { new Pure.DI.UsageTests.BCL.SpanScenario.Dependency(), new Pure.DI.UsageTests.BCL.SpanScenario.Dependency(), new Pure.DI.UsageTests.BCL.SpanScenario.Dependency() }; - return new Pure.DI.UsageTests.BCL.SpanScenario.Service(transientM04D13di1_ReadOnlySpan); + return new Pure.DI.UsageTests.BCL.SpanScenario.Service(transientM04D20di1_ReadOnlySpan); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -145,18 +147,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -177,7 +179,6 @@ partial class Composition " + object Resolve(Type type)\n" + " + object Resolve(Type type, object? tag)\n" + " }\n" + - " class ReadOnlySpanᐸDependencyᐳ\n" + " class Dependency {\n" + " +Dependency()\n" + " }\n" + @@ -185,35 +186,36 @@ partial class Composition " class Service {\n" + " +Service(ReadOnlySpanᐸDependencyᐳ dependencies)\n" + " }\n" + + " class ReadOnlySpanᐸDependencyᐳ\n" + " class IService {\n" + " <>\n" + " }\n" + + " Service *-- ReadOnlySpanᐸDependencyᐳ : ReadOnlySpanᐸDependencyᐳ\n" + + " Composition ..> Service : IService Root\n" + " ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'a' Dependency\n" + " ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'b' Dependency\n" + - " ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'c' Dependency\n" + - " Service *-- ReadOnlySpanᐸDependencyᐳ : ReadOnlySpanᐸDependencyᐳ\n" + - " Composition ..> Service : IService Root"; + " ReadOnlySpanᐸDependencyᐳ *-- Dependency : 'c' Dependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.SpanScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.SpanScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -226,7 +228,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.SpanScenario.IService Resolve(Composition composition) { diff --git a/readme/tag-attribute.md b/readme/tag-attribute.md index c060e45c5..6ab6fcfc7 100644 --- a/readme/tag-attribute.md +++ b/readme/tag-attribute.md @@ -89,16 +89,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Basics.TagAttributeScenario.IService Root @@ -110,31 +110,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -147,18 +149,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -202,25 +204,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagAttributeScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagAttributeScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -233,7 +235,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.TagAttributeScenario.IService Resolve(Composition composition) { diff --git a/readme/tag-type.md b/readme/tag-type.md index 00588156a..b5be39490 100644 --- a/readme/tag-type.md +++ b/readme/tag-type.md @@ -101,20 +101,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency _singletonM04D13di37_XyzDependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency _singletonM04D20di37_XyzDependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Advanced.TagTypeScenario.IDependency XyzRoot @@ -122,18 +122,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di37_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di37_XyzDependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di37_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di37_XyzDependency == null) { - _singletonM04D13di37_XyzDependency = new Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency(); - _rootM04D13di._singletonM04D13di37_XyzDependency = _singletonM04D13di37_XyzDependency; + _singletonM04D20di37_XyzDependency = new Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency(); + _rootM04D20di._singletonM04D20di37_XyzDependency = _singletonM04D20di37_XyzDependency; } } } - return _rootM04D13di._singletonM04D13di37_XyzDependency; + return _rootM04D20di._singletonM04D20di37_XyzDependency; } } @@ -142,46 +142,48 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di37_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di37_XyzDependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di37_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di37_XyzDependency == null) { - _singletonM04D13di37_XyzDependency = new Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency(); - _rootM04D13di._singletonM04D13di37_XyzDependency = _singletonM04D13di37_XyzDependency; + _singletonM04D20di37_XyzDependency = new Pure.DI.UsageTests.Advanced.TagTypeScenario.XyzDependency(); + _rootM04D20di._singletonM04D20di37_XyzDependency = _singletonM04D20di37_XyzDependency; } } } - return new Pure.DI.UsageTests.Advanced.TagTypeScenario.Service(new Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency(), _rootM04D13di._singletonM04D13di37_XyzDependency, new Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency()); + return new Pure.DI.UsageTests.Advanced.TagTypeScenario.Service(new Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency(), _rootM04D20di._singletonM04D20di37_XyzDependency, new Pure.DI.UsageTests.Advanced.TagTypeScenario.AbcDependency()); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -194,18 +196,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -253,28 +255,28 @@ partial class Composition " Composition ..> XyzDependency : IDependency XyzRoot"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.IDependency), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.IService), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.IDependency), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagTypeScenario.IService), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -287,7 +289,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.TagTypeScenario.IDependency Resolve(Composition composition) { @@ -305,7 +307,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Advanced.TagTypeScenario.IService Resolve(Composition composition) { diff --git a/readme/tag-unique.md b/readme/tag-unique.md index 6d2144815..f44657c36 100644 --- a/readme/tag-unique.md +++ b/readme/tag-unique.md @@ -47,6 +47,10 @@ classDiagram + object Resolve(Type type) + object Resolve(Type type, object? tag) } + ServiceᐸStringᐳ --|> IServiceᐸStringᐳ : + class ServiceᐸStringᐳ { + +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies) + } class IEnumerableᐸIDependencyᐸStringᐳᐳ AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : Unique tag 1 class AbcDependencyᐸStringᐳ { @@ -56,20 +60,16 @@ classDiagram class XyzDependencyᐸStringᐳ { +XyzDependency() } - ServiceᐸStringᐳ --|> IServiceᐸStringᐳ : - class ServiceᐸStringᐳ { - +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies) - } - class IDependencyᐸStringᐳ { + class IServiceᐸStringᐳ { <> } - class IServiceᐸStringᐳ { + class IDependencyᐸStringᐳ { <> } - IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : Unique tag 1 IDependencyᐸStringᐳ - IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : Unique tag 2 IDependencyᐸStringᐳ Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ Root ServiceᐸStringᐳ o-- "PerBlock" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ + IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : Unique tag 1 IDependencyᐸStringᐳ + IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : Unique tag 2 IDependencyᐸStringᐳ ``` @@ -80,16 +80,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Advanced.TagUniqueScenario.IService Root @@ -98,41 +98,43 @@ partial class Composition get { [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x200)] - System.Collections.Generic.IEnumerable> LocalperBlockM04D13di1_IEnumerable() + System.Collections.Generic.IEnumerable> LocalperBlockM04D20di1_IEnumerable() { yield return new Pure.DI.UsageTests.Advanced.TagUniqueScenario.AbcDependency(); yield return new Pure.DI.UsageTests.Advanced.TagUniqueScenario.XyzDependency(); } - System.Collections.Generic.IEnumerable> perBlockM04D13di1_IEnumerable = LocalperBlockM04D13di1_IEnumerable(); - return new Pure.DI.UsageTests.Advanced.TagUniqueScenario.Service(perBlockM04D13di1_IEnumerable); + System.Collections.Generic.IEnumerable> perBlockM04D20di1_IEnumerable = LocalperBlockM04D20di1_IEnumerable(); + return new Pure.DI.UsageTests.Advanced.TagUniqueScenario.Service(perBlockM04D20di1_IEnumerable); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -145,18 +147,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -177,6 +179,10 @@ partial class Composition " + object Resolve(Type type)\n" + " + object Resolve(Type type, object? tag)\n" + " }\n" + + " ServiceᐸStringᐳ --|> IServiceᐸStringᐳ : \n" + + " class ServiceᐸStringᐳ {\n" + + " +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies)\n" + + " }\n" + " class IEnumerableᐸIDependencyᐸStringᐳᐳ\n" + " AbcDependencyᐸStringᐳ --|> IDependencyᐸStringᐳ : Unique tag 1 \n" + " class AbcDependencyᐸStringᐳ {\n" + @@ -186,41 +192,37 @@ partial class Composition " class XyzDependencyᐸStringᐳ {\n" + " +XyzDependency()\n" + " }\n" + - " ServiceᐸStringᐳ --|> IServiceᐸStringᐳ : \n" + - " class ServiceᐸStringᐳ {\n" + - " +Service(IEnumerableᐸIDependencyᐸStringᐳᐳ dependencies)\n" + - " }\n" + - " class IDependencyᐸStringᐳ {\n" + + " class IServiceᐸStringᐳ {\n" + " <>\n" + " }\n" + - " class IServiceᐸStringᐳ {\n" + + " class IDependencyᐸStringᐳ {\n" + " <>\n" + " }\n" + - " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : Unique tag 1 IDependencyᐸStringᐳ\n" + - " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : Unique tag 2 IDependencyᐸStringᐳ\n" + " Composition ..> ServiceᐸStringᐳ : IServiceᐸStringᐳ Root\n" + - " ServiceᐸStringᐳ o-- \"PerBlock\" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ"; + " ServiceᐸStringᐳ o-- \"PerBlock\" IEnumerableᐸIDependencyᐸStringᐳᐳ : IEnumerableᐸIDependencyᐸStringᐳᐳ\n" + + " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- AbcDependencyᐸStringᐳ : Unique tag 1 IDependencyᐸStringᐳ\n" + + " IEnumerableᐸIDependencyᐸStringᐳᐳ *-- XyzDependencyᐸStringᐳ : Unique tag 2 IDependencyᐸStringᐳ"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di>.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di>.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Advanced.TagUniqueScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -233,7 +235,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver> + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver> { public Pure.DI.UsageTests.Advanced.TagUniqueScenario.IService Resolve(Composition composition) { diff --git a/readme/tags.md b/readme/tags.md index 1453b6465..79b85d493 100644 --- a/readme/tags.md +++ b/readme/tags.md @@ -105,20 +105,20 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; - private Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency _singletonM04D13di37_XyzDependency; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; + private Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency _singletonM04D20di37_XyzDependency; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Basics.TagsScenario.IDependency XyzRoot @@ -126,18 +126,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di37_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di37_XyzDependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di37_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di37_XyzDependency == null) { - _singletonM04D13di37_XyzDependency = new Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency(); - _rootM04D13di._singletonM04D13di37_XyzDependency = _singletonM04D13di37_XyzDependency; + _singletonM04D20di37_XyzDependency = new Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency(); + _rootM04D20di._singletonM04D20di37_XyzDependency = _singletonM04D20di37_XyzDependency; } } } - return _rootM04D13di._singletonM04D13di37_XyzDependency; + return _rootM04D20di._singletonM04D20di37_XyzDependency; } } @@ -146,46 +146,48 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - if (_rootM04D13di._singletonM04D13di37_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di37_XyzDependency == null) { - lock (_lockM04D13di) + lock (_lockM04D20di) { - if (_rootM04D13di._singletonM04D13di37_XyzDependency == null) + if (_rootM04D20di._singletonM04D20di37_XyzDependency == null) { - _singletonM04D13di37_XyzDependency = new Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency(); - _rootM04D13di._singletonM04D13di37_XyzDependency = _singletonM04D13di37_XyzDependency; + _singletonM04D20di37_XyzDependency = new Pure.DI.UsageTests.Basics.TagsScenario.XyzDependency(); + _rootM04D20di._singletonM04D20di37_XyzDependency = _singletonM04D20di37_XyzDependency; } } } - return new Pure.DI.UsageTests.Basics.TagsScenario.Service(new Pure.DI.UsageTests.Basics.TagsScenario.AbcDependency(), _rootM04D13di._singletonM04D13di37_XyzDependency, new Pure.DI.UsageTests.Basics.TagsScenario.AbcDependency()); + return new Pure.DI.UsageTests.Basics.TagsScenario.Service(new Pure.DI.UsageTests.Basics.TagsScenario.AbcDependency(), _rootM04D20di._singletonM04D20di37_XyzDependency, new Pure.DI.UsageTests.Basics.TagsScenario.AbcDependency()); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -198,18 +200,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 4)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -257,28 +259,28 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - var valResolverM04D13di_0001 = new ResolverM04D13di_0001(); - ResolverM04D13di.Value = valResolverM04D13di_0001; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + var valResolverM04D20di_0001 = new ResolverM04D20di_0001(); + ResolverM04D20di.Value = valResolverM04D20di_0001; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 4, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[2] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagsScenario.IDependency), valResolverM04D13di_0000) - ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagsScenario.IService), valResolverM04D13di_0001) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagsScenario.IDependency), valResolverM04D20di_0000) + ,new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TagsScenario.IService), valResolverM04D20di_0001) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -291,7 +293,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.TagsScenario.IDependency Resolve(Composition composition) { @@ -310,7 +312,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0001: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0001: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.TagsScenario.IService Resolve(Composition composition) { diff --git a/readme/task.md b/readme/task.md index 2e8adc201..581626eba 100644 --- a/readme/task.md +++ b/readme/task.md @@ -110,50 +110,50 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public Pure.DI.UsageTests.BCL.TaskScenario.IService GetRoot(System.Threading.CancellationToken cancellationToken) { - var perResolveM04D13di42_Func = default(System.Func); - System.Threading.Tasks.TaskScheduler transientM04D13di5_TaskScheduler = TaskScheduler.Current; - System.Threading.Tasks.TaskContinuationOptions transientM04D13di4_TaskContinuationOptions = global::System.Threading.Tasks.TaskContinuationOptions.None; - System.Threading.Tasks.TaskCreationOptions transientM04D13di3_TaskCreationOptions = global::System.Threading.Tasks.TaskCreationOptions.None; - System.Threading.Tasks.TaskFactory perBlockM04D13di2_TaskFactory; + var perResolveM04D20di42_Func = default(System.Func); + System.Threading.Tasks.TaskScheduler transientM04D20di5_TaskScheduler = TaskScheduler.Current; + System.Threading.Tasks.TaskContinuationOptions transientM04D20di4_TaskContinuationOptions = global::System.Threading.Tasks.TaskContinuationOptions.None; + System.Threading.Tasks.TaskCreationOptions transientM04D20di3_TaskCreationOptions = global::System.Threading.Tasks.TaskCreationOptions.None; + System.Threading.Tasks.TaskFactory perBlockM04D20di2_TaskFactory; { - var cancellationToken_M04D13di1 = cancellationToken; - var taskCreationOptions_M04D13di2 = transientM04D13di3_TaskCreationOptions; - var taskContinuationOptions_M04D13di3 = transientM04D13di4_TaskContinuationOptions; - var taskScheduler_M04D13di4 = transientM04D13di5_TaskScheduler; - perBlockM04D13di2_TaskFactory = new global::System.Threading.Tasks.TaskFactory(cancellationToken_M04D13di1, taskCreationOptions_M04D13di2, taskContinuationOptions_M04D13di3, taskScheduler_M04D13di4); + var cancellationToken_M04D20di1 = cancellationToken; + var taskCreationOptions_M04D20di2 = transientM04D20di3_TaskCreationOptions; + var taskContinuationOptions_M04D20di3 = transientM04D20di4_TaskContinuationOptions; + var taskScheduler_M04D20di4 = transientM04D20di5_TaskScheduler; + perBlockM04D20di2_TaskFactory = new global::System.Threading.Tasks.TaskFactory(cancellationToken_M04D20di1, taskCreationOptions_M04D20di2, taskContinuationOptions_M04D20di3, taskScheduler_M04D20di4); } - perResolveM04D13di42_Func = new global::System.Func( + perResolveM04D20di42_Func = new global::System.Func( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var factory_M04D13di5 = new Pure.DI.UsageTests.BCL.TaskScenario.Dependency(); - return factory_M04D13di5; + var value_M04D20di5 = new Pure.DI.UsageTests.BCL.TaskScenario.Dependency(); + return value_M04D20di5; }); - System.Threading.Tasks.Task transientM04D13di1_Task; + System.Threading.Tasks.Task transientM04D20di1_Task; { - var factory_M04D13di6 = perResolveM04D13di42_Func; - var taskFactory_M04D13di7 = perBlockM04D13di2_TaskFactory; - transientM04D13di1_Task = taskFactory_M04D13di7.StartNew(factory_M04D13di6); + var factory_M04D20di6 = perResolveM04D20di42_Func; + var taskFactory_M04D20di7 = perBlockM04D20di2_TaskFactory; + transientM04D20di1_Task = taskFactory_M04D20di7.StartNew(factory_M04D20di6); } - return new Pure.DI.UsageTests.BCL.TaskScenario.Service(transientM04D13di1_Task); + return new Pure.DI.UsageTests.BCL.TaskScenario.Service(transientM04D20di1_Task); } public override string ToString() diff --git a/readme/threadsafe-hint.md b/readme/threadsafe-hint.md index 5fe3851c5..0d253991f 100644 --- a/readme/threadsafe-hint.md +++ b/readme/threadsafe-hint.md @@ -65,16 +65,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Hints.ThreadSafeHintScenario.IService Root @@ -86,31 +86,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -123,18 +125,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -173,25 +175,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.ThreadSafeHintScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.ThreadSafeHintScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -204,7 +206,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.ThreadSafeHintScenario.IService Resolve(Composition composition) { diff --git a/readme/tostring-hint.md b/readme/tostring-hint.md index f6ffb453d..b38ee9e01 100644 --- a/readme/tostring-hint.md +++ b/readme/tostring-hint.md @@ -63,16 +63,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Hints.ToStringHintScenario.IService MyService @@ -84,31 +84,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -121,18 +123,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -171,25 +173,25 @@ partial class Composition " Composition ..> Service : IService MyService"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.ToStringHintScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Hints.ToStringHintScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -202,7 +204,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Hints.ToStringHintScenario.IService Resolve(Composition composition) { diff --git a/readme/tracking-disposable-instances-in-delegates.md b/readme/tracking-disposable-instances-in-delegates.md index 28fca5057..b5b2f5051 100644 --- a/readme/tracking-disposable-instances-in-delegates.md +++ b/readme/tracking-disposable-instances-in-delegates.md @@ -106,19 +106,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service Root @@ -126,59 +126,61 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var perResolveM04D13di39_Func = default(System.Func>); - perResolveM04D13di39_Func = new global::System.Func>( + var perResolveM04D20di39_Func = default(System.Func>); + perResolveM04D20di39_Func = new global::System.Func>( [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)768)] () => { - var accumulatorM04D13di38 = new Pure.DI.Owned(); - Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Dependency transientM04D13di3_Dependency = new Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Dependency(); - lock (_lockM04D13di) + var accumulatorM04D20di38 = new Pure.DI.Owned(); + Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Dependency transientM04D20di3_Dependency = new Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Dependency(); + lock (_lockM04D20di) { - accumulatorM04D13di38.Add(transientM04D13di3_Dependency); + accumulatorM04D20di38.Add(transientM04D20di3_Dependency); } - Pure.DI.Owned perBlockM04D13di1_Owned; + Pure.DI.Owned perBlockM04D20di1_Owned; { - var owned_M04D13di2 = accumulatorM04D13di38; - var value_M04D13di3 = transientM04D13di3_Dependency; - perBlockM04D13di1_Owned = new Owned(value_M04D13di3, owned_M04D13di2); + var owned_M04D20di2 = accumulatorM04D20di38; + var value_M04D20di3 = transientM04D20di3_Dependency; + perBlockM04D20di1_Owned = new Owned(value_M04D20di3, owned_M04D20di2); } - lock (_lockM04D13di) + lock (_lockM04D20di) { - accumulatorM04D13di38.Add(perBlockM04D13di1_Owned); + accumulatorM04D20di38.Add(perBlockM04D20di1_Owned); } - var factory_M04D13di1 = perBlockM04D13di1_Owned; - return factory_M04D13di1; + var value_M04D20di1 = perBlockM04D20di1_Owned; + return value_M04D20di1; }); - return new Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service(perResolveM04D13di39_Func); + return new Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service(perResolveM04D20di39_Func); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -191,18 +193,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -247,25 +249,25 @@ partial class Composition " OwnedᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -278,7 +280,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Basics.TrackingDisposableInDelegatesScenario.Service Resolve(Composition composition) { diff --git a/readme/tracking-disposable-instances-per-a-composition-root.md b/readme/tracking-disposable-instances-per-a-composition-root.md index be213a4a5..780da8e55 100644 --- a/readme/tracking-disposable-instances-per-a-composition-root.md +++ b/readme/tracking-disposable-instances-per-a-composition-root.md @@ -99,19 +99,19 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; - private readonly object _lockM04D13di; + private readonly Composition _rootM04D20di; + private readonly object _lockM04D20di; public Composition() { - _rootM04D13di = this; - _lockM04D13di = new object(); + _rootM04D20di = this; + _lockM04D20di = new object(); } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; - _lockM04D13di = _rootM04D13di._lockM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; + _lockM04D20di = _rootM04D20di._lockM04D20di; } public Pure.DI.Owned Root @@ -119,34 +119,36 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - var accumulatorM04D13di38 = new Pure.DI.Owned(); - Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Dependency transientM04D13di3_Dependency = new Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Dependency(); - lock (_lockM04D13di) + var accumulatorM04D20di38 = new Pure.DI.Owned(); + Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Dependency transientM04D20di3_Dependency = new Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Dependency(); + lock (_lockM04D20di) { - accumulatorM04D13di38.Add(transientM04D13di3_Dependency); + accumulatorM04D20di38.Add(transientM04D20di3_Dependency); } - Pure.DI.Owned perBlockM04D13di0_Owned; + Pure.DI.Owned perBlockM04D20di0_Owned; { - var owned_M04D13di1 = accumulatorM04D13di38; - var value_M04D13di2 = new Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Service(transientM04D13di3_Dependency); - perBlockM04D13di0_Owned = new Owned(value_M04D13di2, owned_M04D13di1); + var owned_M04D20di1 = accumulatorM04D20di38; + var value_M04D20di2 = new Pure.DI.UsageTests.Basics.TrackingDisposableScenario.Service(transientM04D20di3_Dependency); + perBlockM04D20di0_Owned = new Owned(value_M04D20di2, owned_M04D20di1); } - lock (_lockM04D13di) + lock (_lockM04D20di) { - accumulatorM04D13di38.Add(perBlockM04D13di0_Owned); + accumulatorM04D20di38.Add(perBlockM04D20di0_Owned); } - return perBlockM04D13di0_Owned; + return perBlockM04D20di0_Owned; } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] @@ -196,9 +198,9 @@ partial class Composition } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { diff --git a/readme/transient.md b/readme/transient.md index dea11253e..a7fe413cc 100644 --- a/readme/transient.md +++ b/readme/transient.md @@ -76,16 +76,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Lifetimes.TransientScenario.IService Root @@ -97,31 +97,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -134,18 +136,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -185,25 +187,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.TransientScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Lifetimes.TransientScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -216,7 +218,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Lifetimes.TransientScenario.IService Resolve(Composition composition) { diff --git a/readme/tuple.md b/readme/tuple.md index 8fc0c34c3..052eb400d 100644 --- a/readme/tuple.md +++ b/readme/tuple.md @@ -77,16 +77,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.TupleScenario.IService Root @@ -94,36 +94,38 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - Pure.DI.UsageTests.BCL.TupleScenario.Point transientM04D13di2_Point = new Point(7, 9); - return new Pure.DI.UsageTests.BCL.TupleScenario.Service((transientM04D13di2_Point, new Pure.DI.UsageTests.BCL.TupleScenario.Dependency())); + Pure.DI.UsageTests.BCL.TupleScenario.Point transientM04D20di2_Point = new Point(7, 9); + return new Pure.DI.UsageTests.BCL.TupleScenario.Service((transientM04D20di2_Point, new Pure.DI.UsageTests.BCL.TupleScenario.Dependency())); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -136,18 +138,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -192,25 +194,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.TupleScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.TupleScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -223,7 +225,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.TupleScenario.IService Resolve(Composition composition) { diff --git a/readme/type-attribute.md b/readme/type-attribute.md index c19982bf0..06e340a36 100644 --- a/readme/type-attribute.md +++ b/readme/type-attribute.md @@ -80,16 +80,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.Attributes.TypeAttributeScenario.IService Root @@ -101,31 +101,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -138,18 +140,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -188,25 +190,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.TypeAttributeScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.Attributes.TypeAttributeScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -219,7 +221,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.Attributes.TypeAttributeScenario.IService Resolve(Composition composition) { diff --git a/readme/valuetask.md b/readme/valuetask.md index 886e774fa..f04c39065 100644 --- a/readme/valuetask.md +++ b/readme/valuetask.md @@ -79,16 +79,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.ValueTaskScenario.IService Root @@ -96,40 +96,42 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] get { - System.Threading.Tasks.ValueTask transientM04D13di1_ValueTask; + System.Threading.Tasks.ValueTask transientM04D20di1_ValueTask; { - var value_M04D13di1 = new Pure.DI.UsageTests.BCL.ValueTaskScenario.Dependency(); - transientM04D13di1_ValueTask = new global::System.Threading.Tasks.ValueTask(value_M04D13di1); + var value_M04D20di1 = new Pure.DI.UsageTests.BCL.ValueTaskScenario.Dependency(); + transientM04D20di1_ValueTask = new global::System.Threading.Tasks.ValueTask(value_M04D20di1); } - return new Pure.DI.UsageTests.BCL.ValueTaskScenario.Service(transientM04D13di1_ValueTask); + return new Pure.DI.UsageTests.BCL.ValueTaskScenario.Service(transientM04D20di1_ValueTask); } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -142,18 +144,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -194,25 +196,25 @@ partial class Composition " ValueTaskᐸIDependencyᐳ *-- Dependency : IDependency"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ValueTaskScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.ValueTaskScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -225,7 +227,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.ValueTaskScenario.IService Resolve(Composition composition) { diff --git a/readme/weak-reference.md b/readme/weak-reference.md index 91a62a57c..9cb188603 100644 --- a/readme/weak-reference.md +++ b/readme/weak-reference.md @@ -70,16 +70,16 @@ classDiagram ```c# partial class Composition { - private readonly Composition _rootM04D13di; + private readonly Composition _rootM04D20di; public Composition() { - _rootM04D13di = this; + _rootM04D20di = this; } internal Composition(Composition baseComposition) { - _rootM04D13di = baseComposition._rootM04D13di; + _rootM04D20di = baseComposition._rootM04D20di; } public Pure.DI.UsageTests.BCL.WeakReferenceScenario.IService Root @@ -91,31 +91,33 @@ partial class Composition } } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve() { - return ResolverM04D13di.Value.Resolve(this); + return ResolverM04D20di.Value.Resolve(this); } + [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public T Resolve(object? tag) { - return ResolverM04D13di.Value.ResolveByTag(this, tag); + return ResolverM04D20di.Value.ResolveByTag(this, tag); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D13di(type, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.Resolve(this) : ResolveM04D20di(type, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, int index) + private object ResolveM04D20di(global::System.Type type, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.Resolve(this); @@ -128,18 +130,18 @@ partial class Composition [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x100)] public object Resolve(global::System.Type type, object? tag) { - var index = (int)(_bucketSizeM04D13di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); - ref var pair = ref _bucketsM04D13di[index]; - return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D13di(type, tag, index); + var index = (int)(_bucketSizeM04D20di * ((uint)global::System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(type) % 1)); + ref var pair = ref _bucketsM04D20di[index]; + return pair.Key == type ? pair.Value.ResolveByTag(this, tag) : ResolveM04D20di(type, tag, index); } [global::System.Runtime.CompilerServices.MethodImpl((global::System.Runtime.CompilerServices.MethodImplOptions)0x8)] - private object ResolveM04D13di(global::System.Type type, object? tag, int index) + private object ResolveM04D20di(global::System.Type type, object? tag, int index) { - var finish = index + _bucketSizeM04D13di; + var finish = index + _bucketSizeM04D20di; while (++index < finish) { - ref var pair = ref _bucketsM04D13di[index]; + ref var pair = ref _bucketsM04D20di[index]; if (pair.Key == type) { return pair.Value.ResolveByTag(this, tag); @@ -182,25 +184,25 @@ partial class Composition " Composition ..> Service : IService Root"; } - private readonly static int _bucketSizeM04D13di; - private readonly static global::Pure.DI.Pair>[] _bucketsM04D13di; + private readonly static int _bucketSizeM04D20di; + private readonly static global::Pure.DI.Pair>[] _bucketsM04D20di; static Composition() { - var valResolverM04D13di_0000 = new ResolverM04D13di_0000(); - ResolverM04D13di.Value = valResolverM04D13di_0000; - _bucketsM04D13di = global::Pure.DI.Buckets>.Create( + var valResolverM04D20di_0000 = new ResolverM04D20di_0000(); + ResolverM04D20di.Value = valResolverM04D20di_0000; + _bucketsM04D20di = global::Pure.DI.Buckets>.Create( 1, - out _bucketSizeM04D13di, + out _bucketSizeM04D20di, new global::Pure.DI.Pair>[1] { - new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.WeakReferenceScenario.IService), valResolverM04D13di_0000) + new global::Pure.DI.Pair>(typeof(Pure.DI.UsageTests.BCL.WeakReferenceScenario.IService), valResolverM04D20di_0000) }); } - private sealed class ResolverM04D13di: global::Pure.DI.IResolver + private sealed class ResolverM04D20di: global::Pure.DI.IResolver { - public static global::Pure.DI.IResolver Value = new ResolverM04D13di(); + public static global::Pure.DI.IResolver Value = new ResolverM04D20di(); public T Resolve(Composition composite) { @@ -213,7 +215,7 @@ partial class Composition } } - private sealed class ResolverM04D13di_0000: global::Pure.DI.IResolver + private sealed class ResolverM04D20di_0000: global::Pure.DI.IResolver { public Pure.DI.UsageTests.BCL.WeakReferenceScenario.IService Resolve(Composition composition) {