├── LazyProxy.Sample
├── LazyProxy.Sample.csproj
├── Services.cs
└── Program.cs
├── LazyProxy
├── LazyProxyBase.cs
├── LazyProxyImplementation.cs
├── LazyProxy.csproj
└── LazyProxyBuilder.cs
├── LICENSE
├── LazyProxy.Tests
├── LazyProxy.Tests.csproj
├── DisposableLazyTests.cs
└── LazyProxyBuilderTests.cs
├── LazyProxy.sln
├── README.md
└── .gitignore
/LazyProxy.Sample/LazyProxy.Sample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | Exe
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/LazyProxy.Sample/Services.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LazyProxy.Sample
4 | {
5 | public interface IMyService
6 | {
7 | void Foo();
8 | }
9 |
10 | public class MyService : IMyService
11 | {
12 | public MyService() => Console.WriteLine("Ctor");
13 | public void Foo() => Console.WriteLine("Foo");
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/LazyProxy/LazyProxyBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LazyProxy
4 | {
5 | ///
6 | /// Base class for lazy proxies.
7 | ///
8 | public abstract class LazyProxyBase
9 | {
10 | ///
11 | /// Initializes inner instance with the valueFactory provided.
12 | ///
13 | /// Function that returns a value.
14 | protected internal abstract void Initialize(Func