Search code examples
wpfwcfentity-frameworkwcf-data-services

How to share entity class between EF, WCF Data Services and Clients?


I have a WPF client application that connects to IIS that hosts WCF Data Services and WCF Services.

Ideally I would like to define a single class that represents a User and then be able to reuse that same class implementation in both the WPF client and web server projects. Therefore my validation code and helper methods are implementation and unit tested just the once in one place. For example...

1, WPF client calls a WCF Services operation and gets back a User entity.
2, WPF client calls WCF Data Services and gets back a User entity.

Is is possible to get WCF Data Services using the same User class as the WCF Service and Entity Framework. If so is it via self tracking entities, POCO classes or some other option?


Solution

  • Seems that you cannot shared the same classes in anything like a meaningful way. So I decided to stick with custom WCF Services instead.