Closed johncrim closed 8 years ago
Here's a related SO post, in case it's helpful feedback to show other examples of developers with entitytypes with different namespaces from the container:
That sounds sensible. We'll take a closer look.
An example is posted here:
https://entityrepository.codeplex.com/SourceControl/latest#examples/Todo-Angular-Breeze/
Note that this is based on your Todo-Angular-Breeze example, but dependencies have been updated to latest, and it uses entityrepository, which provides a number of additions/enhancements on top of web api odata. Proper breeze support is important to this project, as it's one of the clients we want to use/support.
Compared to the standard version of this example project, a bunch of unnecessary code was deleted, and entityrepository configuration was added. The benefits of entityrepository include:
odata/$metadata
is correct/works from Breeze's point of view (is derived from the EF EDM model), but is fixed up to correctly expose entity namespaces.I couldn't use your change directly, because it broke some of our non-OData tests which require CSpace-to-OSpace mapping of the namespaces. Please try my fix and see if it works for you.
Thanks a lot for your work on this.
We commonly manage our domain model types separate from our containers, and this setup is not working with Breeze.js using the
webApiOData
data service adapter. Using Breeze.Client 1.5.4.I've modified the "Todo-Angular-Breeze" example to match this setup, here's the ~/odata/$metadata:
Note that the
EntityContainer
andEntityType
s are in differentSchema
s. This is using web API odata, but that's not central to this issue. I am fixing up the metadata so that it's not broken in the ways that web API odata normally breaks Breeze. The EDM entitytypes have a different namespace from the container, which is why they end up in different schemas in the metadata document.By default if I run the TodoList sample with this setup, the error is:
It appears that the error is in breeze.debug.js line 7324:
which is called from
CsdlMetadataParser.parse(...)
. The parameter values are:This line works as it should:
At this point, result is:
Then the call:
Which then causes the returned result to be:
which is the incorrect typeName.
If I change line 7327 to:
Everything works. I believe this is the correct behavior, in that if the EntityType name is fully scoped, its namespace should be used; and if the EntityType is name only, the surrounding schema namespace should be used.