Using EF 4.1 CodeFirst: How do I expose derived classes? RRS feed

  • Question

  • I have an EF 4.1 context based on a POCO class hierarchy (example: List=>ContainerItem=>BaseItem), and mapped to SQL as Table-Per-Hierarchy. I have DBSets for base and derived classes, and I can access everything just fine from within my MVC3 application.

    I've just added a WCF Data Service, and I can access BaseItems just fine, but not ContainerItems or Lists. The context defines DBSets for each class.

    I found some older posts indicating that the only way to get around this was to create IQueryable service operations for each derived class, but that seems like it would not be as clean on either the server or client side, and it's hard to believe there isn't a better way by now. I did see a reference to the March 2011 Data Services CTP that sounded like it might address the issue, but I'm reluctant to install it unless I really believe it's going to help.

    Anyone know a better way?

    • Moved by Ashleigh Farnham [MSFT] Wednesday, October 19, 2011 5:41 PM Entity Framework Related Question (From:WCF Data Services)
    Wednesday, September 21, 2011 12:14 AM