views:

40

answers:

0

I am currently working on a project where I create a Data Service based on an Entity Data Model. In my Entity Model I have several inherited entities (Such as Orders (Base), Prescriptions (Inherited)). From my data services I am having a problem through the data service where I can't reference the inherited type (prescriptions) only the base (orders). The Entity Data Model appears to be working correctly because if I access it directly from the web project that contains the entity model I get no errors as you will see below...

    Dim context As New BSCloudService_WebRole.BloomSkyEntities
    Dim results = From orders In context.Orders _
                    Where TypeOf orders Is Prescription _
                    Select orders

However when I access the entities from my Data Service (inside a SilverLight project) I get a syntax error over the underlined code stating that "Expression of type Order can never be of type Prescription". Also when viewing the entities through the data services in IE, there is no way to view the inherited types of Prescription, the only thing that appears is Orders. Finally through intelisense I can't access Prescriptions or any of its data attributes.

Dim svc As New BSData.BloomSkyEntities(New Uri("BSData.svc", UriKind.Relative))
Public Sub New()
    InitializeComponent()

    'Get all prescriptions for a particular patient
    Dim prescs4Patients = From orders In svc.Orders _
                          Where TypeOf orders Is Prescription _
                          Select orders