Search code examples
.netshared-librariesremotingpropertygrid

Where should info for PropertyGrid go?


We're using .NET Remoting with a Client/Shared/Server architecture where:

Shared DLL: common to both Client and Server
Server EXE: implements Shared interfaces
Client EXE: creates proxies of Shared interfaces to access Server

Now, on the Client-side, we need to have some of the class objects editable via a PropertyGrid which will then be updated to Server.

Option A: mark the Shared classes with all the necessary System.ComponentModel attributes for PropertyGrid
Option B: use near 1:1 wrapper classes in Client and use System.ComponentModel attributes? (PITA because of code duplication)
Option C: ?


Solution

  • PropertyGrid looks at the object - it isn't really interested in interfaces (and explicit interface implementations won't even show in PropertyGid).

    If you already have a view-model approach then obviously decorate the view-model.

    It really comes down to how much separation you want. Since you are sharing the library it isn't beyond reason to decorate the underlying model; however, if you don't want the UI knowing about the underlying types, then add a view-model, perhaps with the view-model talking to the interfaces (so it doesn't care what the actual implementation is).