Skip to content

Commit c2ac099

Browse files
Remove redundant info.
1 parent 4d7f253 commit c2ac099

File tree

1 file changed

+0
-79
lines changed

1 file changed

+0
-79
lines changed

README.md

-79
Original file line numberDiff line numberDiff line change
@@ -46,85 +46,6 @@ The following is supported:
4646
**Not supported yet:**
4747
- Events
4848

49-
## Lazy injection for IoC containers
50-
51-
A dynamic lazy proxy can be used for IoC containers to change the resolving behaviour.
52-
53-
Dependencies registered as lazy are created as dynamic proxy objects built in real time, but the real classes are resolved only after the first execution of proxy method or property.
54-
55-
Also dynamic lazy proxy allows injection of circular dependencies.
56-
57-
## Implementation for Unity
58-
59-
```C#
60-
var container = new UnityContainer().RegisterLazy<IMyService, MyService>();
61-
62-
Console.WriteLine("Resolving service...");
63-
var service = container.Resolve<IMyService>();
64-
65-
Console.WriteLine("Foo execution...");
66-
service.Foo();
67-
68-
// Resolving service...
69-
// Foo execution...
70-
// Hello from ctor
71-
// Hello from Foo
72-
73-
```
74-
75-
The following is supported:
76-
- Registration of types by interfaces;
77-
- Passing lifetime managers;
78-
- Passing injection members;
79-
- Resolving by child containers.
80-
81-
**Not supported yet:**
82-
- Registration of instances.
83-
84-
## Performance
85-
86-
Here is a result of the [Benchmark test](https://github.com/servicetitan/lazy-proxy/blob/master/LazyProxy.Unity.Tests/UnityExtensionBenchmark.cs)
87-
88-
```
89-
BenchmarkDotNet=v0.10.14, OS=Windows 10.0.17134
90-
Intel Core i5-6600K CPU 3.50GHz (Skylake), 1 CPU, 4 logical and 4 physical cores
91-
Frequency=3421881 Hz, Resolution=292.2369 ns, Timer=TSC
92-
.NET Core SDK=2.1.104
93-
[Host] : .NET Core 2.0.6 (CoreCLR 4.6.26212.01, CoreFX 4.6.26212.01), 64bit RyuJIT
94-
Job-WRIASW : .NET Framework 4.7.1 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.3131.0
95-
Job-AHTPGH : .NET Core 2.0.6 (CoreCLR 4.6.26212.01, CoreFX 4.6.26212.01), 64bit RyuJIT
96-
97-
InvocationCount=1 LaunchCount=10 RunStrategy=ColdStart TargetCount=1
98-
99-
100-
Method | Runtime | Mean | Error | StdDev |
101-
--------------------------- |-------- |------------:|-------------:|------------:|
102-
RegisterType | Clr | 4,137.7 us | 413.30 us | 273.37 us |
103-
RegisterLazy | Clr | 20,674.2 us | 8,720.50 us | 5,768.07 us |
104-
ColdResolveType | Clr | 46,964.2 us | 7,248.30 us | 4,794.30 us |
105-
ColdResolveLazy | Clr | 45,114.7 us | 14,851.68 us | 9,823.47 us |
106-
HotResolveType | Clr | 11,071.5 us | 537.94 us | 355.81 us |
107-
HotResolveLazy | Clr | 459.6 us | 81.59 us | 53.97 us |
108-
InvokeMethod | Clr | 360.1 us | 104.89 us | 69.38 us |
109-
InvokeLazyMethodFirstTime | Clr | 16,164.2 us | 725.08 us | 479.60 us |
110-
InvokeLazyMethodSecondTime | Clr | 315.4 us | 53.41 us | 35.33 us |
111-
RegisterType | Core | 3,687.9 us | 395.56 us | 261.64 us |
112-
RegisterLazy | Core | 17,750.2 us | 7,664.41 us | 5,069.54 us |
113-
ColdResolveType | Core | 50,519.3 us | 2,217.58 us | 1,466.79 us |
114-
ColdResolveLazy | Core | 46,829.4 us | 1,848.44 us | 1,222.63 us |
115-
HotResolveType | Core | 10,911.2 us | 542.79 us | 359.02 us |
116-
HotResolveLazy | Core | 471.4 us | 47.37 us | 31.34 us |
117-
InvokeMethod | Core | 333.8 us | 23.26 us | 15.39 us |
118-
InvokeLazyMethodFirstTime | Core | 16,226.2 us | 527.92 us | 349.18 us |
119-
InvokeLazyMethodSecondTime | Core | 336.4 us | 68.45 us | 45.28 us |
120-
121-
// * Legends *
122-
Mean : Arithmetic mean of all measurements
123-
Error : Half of 99.9% confidence interval
124-
StdDev : Standard deviation of all measurements
125-
1 us : 1 Microsecond (0.000001 sec)
126-
```
127-
12849
## License
12950

13051
This project is licensed under the Apache License, Version 2.0. - see the [LICENSE](https://github.com/servicetitan/lazy-proxy/blob/master/LICENSE) file for details.

0 commit comments

Comments
 (0)