Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Edit</strong><br> Tim S's answer is probably the easiest and safest. However, partial class must all be in the same assembly. If for some reason you cannot edit the assembly containing the proxy classes, you can still do this.</p> <p><strong>Original Answer</strong></p> <p>This might be a little bit excessive.</p> <p>Make a new interface </p> <pre><code>public interface IProxyWrapper { string MyProperty { get; set; } } </code></pre> <p>Implement <code>AWrapper</code> / <code>BWrapper</code> and <code>CWrapper</code>. There are two different ways you could do this. I'll only show <code>A</code> as the rest should be easy from there.</p> <pre><code>public class AWrapper : IProxyWrapper { public string MyProperty { get; set; } } </code></pre> <p>Or</p> <pre><code>public class AWrapper : A, IProxyWrapper { string IProxyWrapper.MyProperty { get { return base.MyProperty; } set { base.MyProperty = value; } } } </code></pre> <p>The benefit of the second is that you can use your <code>AWrapper</code> anywhere you can use an <code>A</code>.</p> <p>Either way, you will need to find a way to get the values from your wrapper to your Proxy class. You could use something like AutoMapper to set the properties, or pass it in as a constructor parameter, store it in a field, and implement <code>IProxyWrapper.MyProperty</code> to wrap <code>A.MyProperty</code>. </p> <p>As for getting the values back to the proxy, there is again AutoMapper, or you can expose the field somehow.</p> <p>You can now customize these wrapper classes further for your application without worrying about losing it when you regenerate your proxies.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload