Just a quick question, is this not supported in the universal Win 8.1 class library? Or, if so, can someone help with what I'm doing wrong.
http://jbsapplication.azurewebsites.net/Modules?$filter=Name%20eq%20'JBS%20Electronic%20forms'&$expand=Menus
When I do this from a browser or Fiddler, I get the correct answer.
My code in the client view model class is as follows (using the created OData Client v2 objects)
var application = new UriBuilder(ServiceBaseAddress); var context = new Models.Application(application.Uri); var modulesQuery = context.Modules.Expand(m=>m.Menus).Where(m => m.Name == ApplicationName); var modules = await ((DataServiceQuery<Module>) modulesQuery).ExecuteAsync(); _currentModule = modules.FirstOrDefault();
In the last line
the following exception is thrown:
The first exception of type exception "Microsoft.OData.Core.ODataException" occurred in Microsoft.OData.Core.DLL
Additional information: When writing a JSON response, the user model must be specified, and the set of objects and entity type must be passed to the ODataMessageWriter.CreateODataEntryWriter method, or ODataFeedAndEntrySerializationInfo must be set to the ODataEntry or ODataFeed that is written.
If I delete the Expand Query part, everything will be fine, but I need to do another round trip to get the menu.
Broken link for module class:
[Key("Id")] public class Module: BindableBase { public string Name { get { return _name; } set { SetProperty(ref _name, value); } } DataServiceCollection<Menu> _menus = new DataServiceCollection<Menu>(null,TrackingMode.AutoChangeTracking); public DataServiceCollection<Menu> Menus { get { return _menus; } set { _menus = value; OnPropertyChanged("Menus"); } } }