locked
Inheritance and relationship RRS feed

  • Question

  •  

    Hello,

     

    Here you are my problem :

     

    I have 3 entities :

    - Actors

    - Orderers which inherite from Actors

    - Projects wich have a 1 to many relationship with actors (1 project is related to one actor).

     

    Thanks to astoria, I can do the following request :

    http://localhost:2135/WebDataService1.svc/Actors(4)

     

    When I do that, Astoria know that my Actors(4) is an orderers ( adsm:type="HOP3Model.Orderers" ). Here you are the result :

     

    <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
    - <entry xml:base="http://localhost:2135/WebDataService1.svc/" xmlns:ads="http://schemas.microsoft.com/ado/2007/08/dataweb" xmlns:adsm="http://schemas.microsoft.com/ado/2007/08/dataweb/metadata" adsm:type="HOP3Model.Orderers" xmlns="http://www.w3.org/2005/Atom">
      <id>http://localhost:2135/WebDataService1.svc/Actors(4)</id>
      <updated />
      <title />
    - <author>
      <name />
      </author>
      <link rel="edit" href="Actors(4)" title="Actors" />
    - <content type="application/xml">
      <ads:IdActor adsm:type="Int32">4</ads:IdActor>
      <adsTongue TiedcreenName>Ben</adsTongue TiedcreenName>
      <ads:Name>Ben's Company</ads:Name>
      <adsTongue Tiediret>1111111111</adsTongue Tiediret>
      <ads:Tel>0613993611</ads:Tel>
      <ads:Fax ads:null="true" />
      <ads:Email>benjamin.talmard@hop-cube.com</ads:Email>
      <adsTongue Tiedector>IT</adsTongue Tiedector>
      </content>
      <link rel="related" title="Projects" href="Actors(4)/Projects" type="application/atom+xml;type=feed" />
      <link rel="related" title="Users" href="Actors(4)/Users" type="application/atom+xml;type=entry" />
      </entry>

     

     

    When I try to do the following request to do get my Projects : http://localhost:2135/WebDataService1.svc/Actors(4)/Projects

    I have a 404 error.

     

    I tried to use the cast function in order to say to astoria that Actors(4) is not only an actor, but is also an orderer :

    http://localhost:2135/WebDataService1.svc/Actors(4)?$filter=cast('HOP3Model.Orderers')

     

    But I have the following error :

    Query options $filter, $orderby, $skip and $top cannot be applied to the requested resource.
       at Microsoft.Data.Web.RequestQueryProcessor.ProcessFilter()
       at Microsoft.Data.Web.RequestQueryProcessor.ProcessQuery()
       at Microsoft.Data.Web.RequestQueryProcessor.ProcessQuery(IWebDataService service, RequestDescription description)
       at Microsoft.Data.Web.RequestUriProcessor.ProcessRequestUri(String requestUri, IWebDataService service)
       at Microsoft.Data.Web.WebDataService`1.ProcessIncomingRequest()

     

    Can you help me ?

    Thanks a lot !

    --

    Ben, France

     

    Friday, April 11, 2008 10:40 PM

Answers

  • The Projects is a navigation property on the subtype. In December CTP, there is no good way to access subtype properties directly (i.e. via the request uri). But navigation properties are more interesting since they are deferred by default.

     

    We don't have a good way to accessing sub-type navigation properties in December CTP nor in the coming beta bits. Given the time frame, its going to hard to fit this in the V1 timeframe. But we are looking at the problem and trying to find something that might help customers in V1.

     

    Sorry, i didn't have a good answer for you.

     

    Thanks

    Pratik

    Tuesday, April 15, 2008 5:24 PM
    Moderator
  •  

    Ok, ADO.Net Data Services V1 seems not to be ready for inheritance scenario... Crying

     

    I hope that my feedback will contribute for the next releases !

     

    Thanks for your replies

    Ben, France

    Tuesday, April 15, 2008 9:08 PM

All replies

  • When I try to do the following request to do get my Projects : http://localhost:2135/WebDataService1.svc/Actors(4)/Projects, I have a 404 error.

     

    One should never get a 404 when querying a collection (Projects is a collection navigation property). Can you tell me something about the provider - is the underlying provider a edm provider or something else?

     

    About the cast functionality, i don't think we had that in the december CTP bits. We added that functionality later on and i should be available in the beta bits (should be coming out sometime soon).

     

    Thanks

    Pratik

    Monday, April 14, 2008 4:19 PM
    Moderator
  •  

    Hello,

     

    Thanks for this answer!

     

    The data provider is an EDM, with the 3 entites

    - Actors

    - Orderers which inherite from Actors

    - Projects, related to Orderers

     

    I don't think that http://localhost:2135/WebDataService1.svc/Actors(4)/Projects is a collection for Astoria. I think that it fail to give me the Projects because Projects are not related to Actors, but to Orderers. It is why it give me a 404...

    But in fact, Actors(4) is also an Orderers (thanks to inheritance), it is why I would like to get the Projects of Acotrs(4)

     

    Is there anything I can do in order to tell Astoria that Actors(4) is a Orderers so it can accept the Projects association ?

     

    Thanks again !

    Sincerly,

    --

    Ben, France

    Monday, April 14, 2008 9:01 PM
  • The Projects is a navigation property on the subtype. In December CTP, there is no good way to access subtype properties directly (i.e. via the request uri). But navigation properties are more interesting since they are deferred by default.

     

    We don't have a good way to accessing sub-type navigation properties in December CTP nor in the coming beta bits. Given the time frame, its going to hard to fit this in the V1 timeframe. But we are looking at the problem and trying to find something that might help customers in V1.

     

    Sorry, i didn't have a good answer for you.

     

    Thanks

    Pratik

    Tuesday, April 15, 2008 5:24 PM
    Moderator
  •  

    Ok, ADO.Net Data Services V1 seems not to be ready for inheritance scenario... Crying

     

    I hope that my feedback will contribute for the next releases !

     

    Thanks for your replies

    Ben, France

    Tuesday, April 15, 2008 9:08 PM