LiteProxy 1.0.1

Tiny object proxying tools for C#

Install-Package LiteProxy -Version 1.0.1
dotnet add package LiteProxy --version 1.0.1
<PackageReference Include="LiteProxy" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LiteProxy --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

LiteProxy

Tiny object proxying tools for C#

Features:

DynamicProxy.GetInstanceFor˂...˃(); -- Pass the type of an interface or abstract, and you will get an object instance that implements that type and backs the properties and fields.

Extract˂Interface˃.From(Instance) -- Wraps an object instance in a proxy. Use this to coerce objects into interfaces they could implement.

LazyDelegate.For(...) -- Wraps a constructor function in a proxy that overrides all virtual properties. Any access to the properties will cause the function to be invoked and calls passed to the result.

LazyDelegate.ForKeyed(ʺIdʺ, MyValue, ConstructorFunc) -- Same as LazyDelegate.For, but this causes one named property with an initial value to skip the lazy invocation.

Example:

var subject = LazyDelegate.ForKeyed("CustomerId", 123, ()=>
        new Customer{
            Email = "test@example.com",
        })
    );


Assert.AreEqual("test@example.com", subject.Email);

LiteProxy

Tiny object proxying tools for C#

Features:

DynamicProxy.GetInstanceFor˂...˃(); -- Pass the type of an interface or abstract, and you will get an object instance that implements that type and backs the properties and fields.

Extract˂Interface˃.From(Instance) -- Wraps an object instance in a proxy. Use this to coerce objects into interfaces they could implement.

LazyDelegate.For(...) -- Wraps a constructor function in a proxy that overrides all virtual properties. Any access to the properties will cause the function to be invoked and calls passed to the result.

LazyDelegate.ForKeyed(ʺIdʺ, MyValue, ConstructorFunc) -- Same as LazyDelegate.For, but this causes one named property with an initial value to skip the lazy invocation.

Example:

var subject = LazyDelegate.ForKeyed("CustomerId", 123, ()=>
        new Customer{
            Email = "test@example.com",
        })
    );


Assert.AreEqual("test@example.com", subject.Email);

Release Notes

Skipping ctor tree

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 1,085 5/14/2018
1.0.0 197 5/14/2018