New Features in CTP2 ADO.NET Data Services v1.5 Explained

After yesterdays post about the availability of the CTP2 of ADO.NET Data Services v1.5 here are some more details regarding the Projections, Feed Customization and Data Binding.

As told before Projections, the possibility of getting only the columns chosen instead of retrieving all the columns. With this we have now a new set of expressions to provide this ability on the URI, and in order to achieve we have now two new keywords available, that are:

 

 

  • But in order for this to work we need to add the following 2 properties to the service:
    • First, make projections available using the URI.
        1: config.DataServiceBehavior.AcceptProjectionRequests = true;
    • Secondly, make the protocol version to V2
        1: config.DataServiceBehavior.MaxProtocolVersion = System.Data.Services.Common.DataServiceProtocolVersion.V2;

 

  • For more information’s regarding this subject read this post from the Product Team.

 

Feed Customizations are the possibility to customize the way the feed is created instead of using only the default AtomPub version.

  • In order to achieve this customization we must use the EntityPropertyMappingAttribute that will define the relationship between the Property and the name that will be used in the feed.

                    In the following sample we are defining that when building the feed, instead of using the complete type definition

        1: <author>
      
        2:    <name>Nuno Godinho</name>
      
        3:    <email>someone@company.com</email>
      
        4: </author>

                   we will have the Author element with the value that is on the Name Property of the Author class (considering that Author is a type that contains several properties and one of them is Name):

 

Data Binding is now simplified, because using the DataServiceCollection class we can bind it directly to the Data Service.

  • For more information’s regarding this subject read this post from the Product Team.

No Comments