OData v3 not working
When I connect to my v3 OData service which has a large schema with multiple namespaces, it downloads and displays the schema correctly along with all the relationships, but as soon as I start a query I get the warning message in the Query window:
"The type or namespace name 'Container' does not exist in the namespace 'LINQPad.User' (Press F4 to check imported namespaces)"
This is because the Container is in a namespace - LINQPad.User.WebApplications.Babel.Models.Entities.Container
But LINQPad assumes it's not in a namespace.
"The type or namespace name 'Container' does not exist in the namespace 'LINQPad.User' (Press F4 to check imported namespaces)"
This is because the Container is in a namespace - LINQPad.User.WebApplications.Babel.Models.Entities.Container
But LINQPad assumes it's not in a namespace.
Comments
As mentioned the issue is that WCF places the Container in the first schema namespace in the metadata that contains entities, rather than in the 'Default' namespace, and as such LINQPad cannot find the Container. This behaviour exists in the latest WCF assemblies.
I was producing the OData using the latest WebAPI OData RC, unfortunately when it creates containers it doesn't set the "isDefaultContainer" attribute on the primary container.
By adding the following code after creating the model -
IEdmEntityContainer container = _edmModel.EntityContainers().First();
_edmModel.SetIsDefaultEntityContainer(container, true);
(Where _edmModel is the model) I managed to set the attribute, and everything started working. Hope that helps someone else.
Thanks for posting your solution! MUCH APPRECIATED :P
Haven't managed to get ODataExplorer to work, but I can see the tables in Excel.