I have a solution containing several projects:
- Class Library with DataContracts definitions
- WCF Service Library (referencing 1)
- WPF UserControl Library
- WPF Client App (with service reference to 2 and reference to 3)
When I use proxy generation with service reference in the WPF Client App, data entities are generated in that project. Next I have WPF User Controls that I use in the WPF Client App and those controls are in a separate project for re-usability. I would like to pass data from the Client App to the UserControls based on some actions.
My question is, how can I reference the same Data entities in both WPF Client App and WPF UserControl library. In the UserControl library I can put a reference to the DataContract project, but those are different type from the data types produced with the proxy in the Client App. Right now im using dynamic in my UserControls and when I pass data from the ClientApp to the UserControls the binding resolves just fine. But i dont like that approach. I want to be able to use generics in my UserControls.
Im aware that if I have access to all of the projects (services and client) I can user ChannelFactory and reference the same DataContracts in all project, but my question now is regarding the scenario where the proxy is generated with a service reference.
So any ideas and best practices on how to share the same data types between different projects?
thanks