locked
Where to create "extension" of partial classes from proxy class generator or entity framework RRS feed

  • Question

  • Hi together,

    I'm gaining my first expierecneces with WCF and Entity Framework.
    In this tutorial (http://msdn.microsoft.com/en-us/data/ee364700.aspx) I learned how to extend the partial classes from Entity Framework to do data validation.

    When I tried to get it to run with with a IIS hosted WCF-Service I discovered that that "only" the base class was exposed to the proxy.

    I had to implement the parts of the partial class also in the "serivce layer" where the proxy classes resident.

    Is this right, or I did something wrong?

    Thanks in advance

    Bernhard
    Monday, March 1, 2010 11:16 AM

Answers

  • Hi,

    I assume you're using WCF Data Services to "host" your EF model over the web.
    In that case the client-side proxy classes are generated from the service metadata. In your case the most important thing to note is that they are not generated from the server-side classes directly.
    As a result the client-side classes don't contain any of your customizations.
    In your case since you're gonna use these customizations on the client, it doesn't make sense to have them on the server. So the best thing is to implement the customizations on top of the client-side proxy classes.
    WCF Data Services doesn't transfer the "code" of your customizations from the server to the client in any way.
    You might want to take a look at WCF RIA Services as well as a possible alternative: http://msdn.microsoft.com/en-us/library/ee707344(VS.91).aspx.

    Thanks,
    Vitek Karas [MSFT]
    • Marked as answer by OrgMulle Monday, March 1, 2010 1:05 PM
    Monday, March 1, 2010 12:40 PM
    Moderator

All replies

  • Hi,

    I assume you're using WCF Data Services to "host" your EF model over the web.
    In that case the client-side proxy classes are generated from the service metadata. In your case the most important thing to note is that they are not generated from the server-side classes directly.
    As a result the client-side classes don't contain any of your customizations.
    In your case since you're gonna use these customizations on the client, it doesn't make sense to have them on the server. So the best thing is to implement the customizations on top of the client-side proxy classes.
    WCF Data Services doesn't transfer the "code" of your customizations from the server to the client in any way.
    You might want to take a look at WCF RIA Services as well as a possible alternative: http://msdn.microsoft.com/en-us/library/ee707344(VS.91).aspx.

    Thanks,
    Vitek Karas [MSFT]
    • Marked as answer by OrgMulle Monday, March 1, 2010 1:05 PM
    Monday, March 1, 2010 12:40 PM
    Moderator
  • Hi Vitek,

    I had now a look at WCF RIA Services. Did I understand it right that RIA is only usable as Service for Silverlight-Clients?

    Thanks in advance

    Bernhard
    Monday, March 1, 2010 3:24 PM
  • Hi,

    Yes, WCF RIA Services are currently only for Silverlight clients.

    Thanks,
    Vitek Karas [MSFT]
    Monday, March 1, 2010 6:48 PM
    Moderator