locked
Why Edm Types and not Standard xsd types RRS feed

  • General discussion

  • I am confused as to why Astoria is exposing all the types as proprietary Edm.* types and not the XSD types.  There is already a full types system available.

    Creating another type system to expose to the outside world just creates more confusion.

    Instead of:
    <d:domain_id m:type="Edm.Int16">

    I believe we should see:
    <d:domain_id type="xs:short">

    Is there an option or flag to change the exposed types?

    Scott Prugh
    • Changed type Scott Prugh Wednesday, January 28, 2009 9:12 PM
    • Changed type Scott Prugh Wednesday, January 28, 2009 9:12 PM
    Wednesday, January 21, 2009 4:48 PM

All replies

  • Hi Scott,
     We discuss the decision to go with the EDM types in our blog post here : http://blogs.msdn.com/astoriateam/archive/2007/09/27/astoria-data-sources-and-system-layering.aspx
    Hope this helps
    Phani Raj Astoria
    Wednesday, January 21, 2009 5:18 PM
    Moderator
  • I am not sure that is a really good answer.  REST is supposed to be easily consumable from downstream clients that don't have .Net.  To consume an Asotria service I now need to translate to and from EDM and XSD standard types on each request.  Sure, this can be done with a case statement but it really violates the spirit of interoperability.

    Scott Prugh
    Wednesday, January 21, 2009 10:18 PM
  • this is a great question that needs to be answered. Anybody from MS has a real answer to it?



    Saturday, January 24, 2009 9:14 PM
  • Muahahaha, no never we will never tell you it is our secret and only the privileged will know!
    -------------------- joking aside

    I am not quite sure why the EDM was used but i can have a wild quess that the the proximity of Entity Framework (where this comes from) the astoria team decided that it was useful to reuse it to further their goals. You have to remember that SQL Server team is also using a version of the Data Service platform (not the same one as they dont use EDM). 

    The data services toolkit is in essence made for the entity framework but it enables developers to use custom data sources on the server side. 
      (Client)                                            (Server)
       (Side)      <===> (Astoria) <===>   (Side)
    (Interface)                                        (Interface)

    The client and server side interfaces can be changed to anything you like.

    For XSD standard types (remember they are not the standard for everything for example they are not standard for JSON) you need to convert the types from EDM to XSD types.

    Now to answer your question:

    No there isnt a flag or property to change that, if you want to change the EDM types on the Atom feed to XSD types then you have to do it yourself.

    Here are some ideas: Have a look at the DataService<T> object into the event and the overriddable methods some of them will allow you to intercept the atom feed before it is sent to the client there you can change the types before it is sent to the client and received from the client.

    Another place to have a look is the DataServiceContext type there you should look at the WrittingEntity and ReadingEntity events you can change the Atom feed to look like what ever you like. remember to add the namespace for the XSD types to the feed so it is all nice a lovelly.

    Hope this helps
    Mark this post as 
    the answer if it 
    Helps

    ps.: spirit of interoperability?! BBC European Court Microsoft is getting better they are becoming the good guys slowly but surelly ^^


    Daniel Portella
    Blogger from hell
    http://undocnet.blogspot.com


    This posting is provided "AS IS" with no warranties, and confers no rights.


    • Edited by Daniel Portella Tuesday, January 27, 2009 12:11 PM giving a possible answer
    Tuesday, January 27, 2009 11:52 AM
  •  I undesrtand the point that xsd types are not standard in Javascript but they are closer to standard then Edm types.  I don't mind EDM per se, but I would like to hide the fact from the client cosumer.

    I would like to see an enhancement here to allow for xsd types or to use xsd types as the default.  MSFT made some good steps with REST here but little things like this are a bug deal and make interop painful.

    I will look at overriding the output.

    -Scott

     

     

     


    Scott Prugh
    Tuesday, January 27, 2009 9:42 PM
  • No no we dont tell you the answer, you have to pay for this kind of support
    --------------joking aside

    You have to remember that Ado.Net Data Services main goals was to give a resource addressing framework that would not tie down the client or the server to a specific standard or product. The Initial release of Data Services has come with the obvious intefaces: The Json and the Atom interfaces, which each have their use. For the Atom interface the best type standard they thought would fit the solution better was the EDM which has on essence all the things they would need to reference types and associations. The real selling point of Data Services is that is you dont like something or a specific out of the box feature does not cut the mustard then you can change it. 

    If you are going to change the types I suggest that you should look at the EDM specification for Data Services to make sure you dont leave anything out. 

    Daniel Portella Blogger from hell http://undocnet.blogspot.com
    if this reply has answer your question please mark as the answer.

    Daniel Portella - http://undocnet.blogspot.com - This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, January 28, 2009 10:21 AM
  • No no we dont tell you the answer, you have to pay for this kind of support
    --------------joking aside

    Hi Scott Prugh

    If this topic is resolved could you please mark the post as answered or at least change to a discussion

    Daniel Portella Blogger from hell http://undocnet.blogspot.com
    If this post answers you question please mark as the answer.

    Daniel Portella - http://undocnet.blogspot.com - This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, January 28, 2009 8:33 PM