on 2014 Oct 07 10:25 AM
Hi,
I'm currently Setting up an OData-service with version 16.0.02003 and have a problem with a "self referencing" entity when creating the service reference in Visual Studio.
I have created a table like this:
drop table if exists Stammdaten.ErledigteArbeiten; create table Stammdaten.ErledigteArbeiten ( GUID uniqueidentifier not null Default newid(), PARENTID uniqueidentifier null, BEZEICHNUNG varchar (60) , TEXT Long varchar, contraint PK_ErledigteArbeiten Primary key (GUID), ); alter table Stammdaten.ErledigteArbeiten add foreign key FK_ErledigteArbeiten_ErledigteArbeitenParent (PARENTID) references Stammdaten.ErledigteArbeiten (GUID) on update restrict on delete cascade;
The corresponding osdl-file is quite simple:
service Namespace "Engel" { entity "Stammdaten"."ErledigteArbeiten"; }
When I try to create a service reference in Visual Studio I get the following error:
Fehler 0042: Name ErledigteArbeiten kann nicht in Typ Engel.ErledigteArbeiten verwendet werden. Elementnamen dürfen nicht mit dem einschließenden Typ übereinstimmen.
Taking a look at the metadata there are two NavigationProperties one with Name "ErledigteArbeiten" and one with "FK_ErledigteArbeiten_ErledigteArbeitenParent". So it's clear that the first one leeds to the error.
IMO this is a bug in the odata producer code ... is there a workaround or what can I do to get this working?
TIA
Armin
Request clarification before answering.
This has been fixed for build 16.0.0.2030. We now ensure that types can not have properties with the same name as the containing type.
Association names also could have the same name as a complex type or entity type. OSDL files with such name conflicts now produce errors and generated navigational properties and associations are given better names.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is certainly an issue. The generation code allows the navigational property to have the same name as its containing property. While some OData clients are less strict, Visual Studio does not allow it.
The work around is to define all associations in the OSDL file.
I suggest you contact support to help us understand the impact of this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
61 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.