Creating a custom property and exposing it via WCF Data Services? RRS feed

  • Question

  • I  spend the last few hours trying to add a custom property to the model and exposing it via WCF data services. This property does not exist in the database and I have no control over the database schema. I've tried adding a partial class with the custom property but it doesn't show up via the WCF web services. My research showed that this isn't possible at the moment with EF4. Is this still true? are there any other alternatives without altering the database schema? 

    Example: (This seems to be an example most others used in the past) I would like to create a custom property called "FullName" by concatenating "first" and "last" that exists in the database and expose it via the WCF Data Services.

    Thanks in advance.

    Saturday, November 5, 2011 3:00 PM

All replies

  • Hi,

    unfortunately, there is no easy way to make this work. without touching the model, your only option is go through a custom provider, i.e., you can wrap the EF object context. If you can touch the model, then you can create a new entity by using DefiningQuery, can create arbitrary properties there.

    Peter Q. http://blogs.msdn.com/peter_qian
    Saturday, November 5, 2011 10:20 PM