0

The most recent update of OData has broken my code, and I'm at a loss for how to fix it. Until now, I've been quite happily using

https://my.url.com/en-GB/odata/applicationuser(2)?$expand=FacebookProfile,TwitterProfile,GoogleProfile

Now, I realise this may break the OData specification, and it may be necessary to use

https://my.url.com/en-GB/odata/applicationuser(2)?$expand=FacebookProfile($select=Name)...

instead, but using either of these gives

"message":"The query specified in the URI is not valid. The property 'FacebookProfile' cannot be used in the $expand query option."

which is somewhat less than helpful. It certainly could be used in the $expand query option until a couple of days ago.

I've tried things like declaring complex types and properties:

protected override EntitySetConfiguration<ApplicationUser> CreateEntitySet(ODataConventionModelBuilder builder, Type controllerType)
{
    builder.ComplexType<FacebookProfile>();
    builder.ComplexType<TwitterProfile>();
    builder.ComplexType<MicrosoftAccountProfile>();
    builder.ComplexType<GoogleProfile>();
    builder.ComplexType<AzureActiveDirectoryProfile>();
    var userType = builder.EntityType<ApplicationUser>();
    userType.ComplexProperty(u => u.FacebookProfile);
    return base.CreateEntitySet(builder, controllerType);
}

but so far nothing has worked.

Does anyone know what has happened in the latest OData NuGet update: specifically, what has been tightened up? And in a word, how was my old implementation violating the specification?

Rob Lyndon
  • 12,089
  • 5
  • 49
  • 74

0 Answers0