views:

14

answers:

1

I have a Server/Client project with WCF communications and sharing a dll between both with Contracts and objects:

Service | Shared Objects | Client

For my Objects I added attributes for use in the propertygrid :

 [DataMember]
        [DisplayName("Javascript File Name")]
        [Description("The browseable path of the Javascript file.")]
        [Browsable(true)]
        [Editor("BaseNS.NS.NS2.ObjectEditor", typeof(System.Drawing.Design.UITypeEditor))]
        public String JavaScriptFileName { get; set; }

I used the (String,Type) constructor of the Editor attribute because the editor will be stored at the client and I dont want to embed it in the shared DLL

Should this work cause I cant get it to ?

A: 

I don't think it's a good idea to add UI code of any form to a data contract class. You are creating a dependency in your model with the UI.

I I would recommend you to use a simple view model class to expose the relevant properties from your model to the view and do the mapping manually (if you need, you can use an existing mapping service to avoid doing it manually).

Anero
Hmmmm I think you are right. I tried so hard to seperate UI logic from my service but did not move it all the way to the client. Will try to implement an object mapper and recreate the classes at the client with the added UI attributes. This will solve the UITypeEditor problem
DeWet

related questions