1

Does someone know library, that reduces amounts of boilerplate code when writing object proxies?

My proxies right now look the following way and I think it's a nasty approach :)

public class SampleTenantProxy : Tenant
{
    public override int? Id
    {
        get { return tenant.Id; }
        set { tenant.Id = value; }
    }
    public override String Code
    {
        get { return tenant.Code; }
        set { tenant.Code = value; }
    }

    public override String Name
    {
        get { return tenant.Name; }
        set { tenant.Name = value; }
    }

    public override Decimal Price
    {
        get { return tenant.Price; }
        set { tenant.Price = value; }
    }

    private readonly Tenant tenant;

    public TenantListBoxProxy(Tenant tenant)
    {
        this.tenant = tenant;
    }

}

2 Answers 2

2

Most Dependency Injection tools (such as Windsor Castle - have a look here) can do it.

Sign up to request clarification or add additional context in comments.

Comments

0

Castle Dynamic Proxy -> http://www.castleproject.org/dynamicproxy/index.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.