none
5.2 RC1 JSON Format - Syndication properties RRS feed

  • Question

  • Hi,

    It seems that when requesting JSON format, any Syndication mapped properties are injected in the select part of the expression that is passed to my DataServiceQueryProvider.

    This must be something that should be optimized. The syndication properties are not used in a JSON payload, so why would they get injected in the expression tree?

    Kind regards

    Uffe

    Tuesday, December 11, 2012 11:01 AM

Answers

  • Thank you Chris,

    Actually the problem is worse than "just" performance related...

    If you have a syndication mapped property with keepInContent = false, then it is not part of the model. When using JSON format it fails to deserialize the response from the server (the server sends it in the JSON payload) but the client fails to deserialize it with an InvalidOperationException "The property 'SyndicationProerty' does not exist on type 'X.YourType'. Make sure to only use property names that are defined by the type". A workaround for this is to specify DataServiceContext.IgnoreMissingAttributes = true on the client.

    Regards

    Uffe

    • Edited by Uffe Lauesen Friday, December 14, 2012 2:47 PM
    • Marked as answer by Alexander Sun Thursday, December 20, 2012 8:09 AM
    Friday, December 14, 2012 2:41 PM

All replies

  • Hey Uffe,

    Interesting behavior. Does this happen only on projection queries or always?

    Thanks,

    Chris Robinson - WCF Data Services


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

    Wednesday, December 12, 2012 4:22 PM
    Moderator
  • Hi Chris,

    This happens always. I will double check it tomorrow and keep you posted.

    Regards

    Uffe

    Wednesday, December 12, 2012 8:48 PM
  • Hi Chris,

    Yes, this happens even with projection queries. It is a performance related issue since the server is forced to fetch the syndication properties for no reason at all - they are not included in the payload. An example is the following query...

    request:

    OData.svc/Overregisters()?$select=Value

    expression passed to my DataServiceQueryProvider:

    The SyndicationTitle and Summary are mapped syndication properties and should not be part of the expression tree.

    .Call System.Linq.Queryable.Select(
        .Constant<Scanjour.Services.OData.SomLinqQuery`1[Scanjour.Services.OData.Resources.SomResource]>(Scanjour.Services.OData.SomLinqQuery`1[Scanjour.Services.OData.Resources.SomResource]),
        '(.Lambda #Lambda1<System.Func`2[Scanjour.Services.OData.Resources.SomResource,System.Data.Services.Internal.ProjectedWrapper4]>))
    
    .Lambda #Lambda1<System.Func`2[Scanjour.Services.OData.Resources.SomResource,System.Data.Services.Internal.ProjectedWrapper4]>(Scanjour.Services.OData.Resources.SomResource $p)
    {
        .New System.Data.Services.Internal.ProjectedWrapper4(){
            ResourceTypeName = .If ($p == null) {
                ""
            } .Else {
                "Som.Overregister"
            },
            PropertyNameList = "Value,ID,Summary,SyndicationTitle",
            ProjectedProperty0 = (System.Object)((System.String).Call System.Data.Services.Providers.DataServiceProviderMethods.GetValue(
                $p .As Scanjour.Services.OData.Resources.SomResource,
                .Constant<System.Data.Services.Providers.ResourceProperty>(System.Data.Services.Providers.ResourceProperty))),
            ProjectedProperty1 = (System.Object)((System.String).Call System.Data.Services.Providers.DataServiceProviderMethods.GetValue(
                $p .As Scanjour.Services.OData.Resources.SomResource,
                .Constant<System.Data.Services.Providers.ResourceProperty>(System.Data.Services.Providers.ResourceProperty))),
            ProjectedProperty2 = (System.Object)((System.String).Call System.Data.Services.Providers.DataServiceProviderMethods.GetValue(
                $p .As Scanjour.Services.OData.Resources.SomResource,
                .Constant<System.Data.Services.Providers.ResourceProperty>(System.Data.Services.Providers.ResourceProperty))),
            ProjectedProperty3 = (System.Object)((System.String).Call System.Data.Services.Providers.DataServiceProviderMethods.GetValue(
                $p .As Scanjour.Services.OData.Resources.SomResource,
                .Constant<System.Data.Services.Providers.ResourceProperty>(System.Data.Services.Providers.ResourceProperty)))
        }
    }

    Regards

    Uffe

    • Edited by Uffe Lauesen Thursday, December 13, 2012 6:09 AM
    Thursday, December 13, 2012 6:06 AM
  • We've opened a bug on this. We'll be looking at fixing this at some point, I can't make any promises on the time frame though as I'm unsure.

    Thanks,

    Chris


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

    Thursday, December 13, 2012 10:15 PM
    Moderator
  • Thank you Chris,

    Actually the problem is worse than "just" performance related...

    If you have a syndication mapped property with keepInContent = false, then it is not part of the model. When using JSON format it fails to deserialize the response from the server (the server sends it in the JSON payload) but the client fails to deserialize it with an InvalidOperationException "The property 'SyndicationProerty' does not exist on type 'X.YourType'. Make sure to only use property names that are defined by the type". A workaround for this is to specify DataServiceContext.IgnoreMissingAttributes = true on the client.

    Regards

    Uffe

    • Edited by Uffe Lauesen Friday, December 14, 2012 2:47 PM
    • Marked as answer by Alexander Sun Thursday, December 20, 2012 8:09 AM
    Friday, December 14, 2012 2:41 PM