This is a migrated thread and some comments may be shown as answers.

WCF DataService Incomplete Metadata

10 Answers 98 Views
Web Services
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Samuel
Top achievements
Rank 1
Samuel asked on 04 Sep 2013, 07:46 AM
I have used Fluent to generate my model and map with the database.

I have a 1-to-many association between a Mandate which holds a collection of OpenPosition entities. Note that on OpenPosition I have a foreign key to Mandate and in the model it is decorated with the ForeignKeyAssociation Attribute.


Then I use a WCF DataService for sending data to the client. But the metadata generated is incomplete. See :

<Association Name="OpenPosition_Mandate_Mandate_OpenPositions">
<
End Type="DirectDebitModel.Mandate" Multiplicity="0..1" Role="Mandate_OpenPositions"/>
<
End Type="DirectDebitModel.OpenPosition" Multiplicity="*" Role="OpenPosition_Mandate"/>
</
Association>

<
EntityContainer Name="FluentModel" m:IsDefaultEntityContainer="true">
<
EntitySet Name="OpenPositions" EntityType="DirectDebitModel.OpenPosition"/>
<
EntitySet Name="Mandates" EntityType="DirectDebitModel.Mandate"/>
<
AssociationSet Name="OpenPosition_Mandate" Association="DirectDebitModel.OpenPosition_Mandate_Mandate_OpenPositions">
<
End Role="OpenPosition_Mandate" EntitySet="OpenPositions"/>
<
End Role="Mandate_OpenPositions" EntitySet="Mandates"/>
</
AssociationSet>
</
EntityContainer>


   The referentialConstraint node inside the Association node is missing ! Normally this is generated when the .HasForeignKey() method is used in the Fluent model (with EntityFramework). I haven't found such a method in the OpenAccess API. But I thought that the ForeignKeyAssociation attribute would be enough.

Telerik openaccess data service implementation seems to ignore completely this feature.

Is this a missing feature or am I doing something wrong ? 

10 Answers, 1 is accepted

Sort by
0
Kaloyan Nikolov
Telerik team
answered on 05 Sep 2013, 11:57 AM
Hi Samuel,

The ReferentialConstraint node in the metadata of services based on EF is a side effect of the metadata provider they use. In general this node is not part of the oData metadata officially. You could check this with some of the sample services like this one.
Also most of the clients do not respect this node, that's why our service metadata provider do not generate this node.  

Do you face any issues because of the missing node? If you do we can try to find a way how workaround it.

I hope this helps. Please do not hesitate to get back to us with any questions. 
 

Regards,
Kaloyan Nikolov
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
0
Samuel
Top achievements
Rank 1
answered on 05 Sep 2013, 12:44 PM
Hi,

Thanks for you reply. I hope you can help me. Actually, ReferentialConstraint IS part of the official ODATA specification since V3. See this link:

http://www.odata.org/documentation/odata-v3-documentation/common-schema-definition-language-csdl/#104_The_edmReferentialConstraint_Element


The thing is that I desperately need this node to be part of the metadata, because I use breezejs on the client side to help with data management in JavaScript and this library relies on the referential constraint node to  build navigation properties.

So far I've been unsuccessful at adding this node to the metadata using OpenAccess (works fine with EF but my company uses OpenAccess).  Do you think you could help  ?
0
Kaloyan Nikolov
Telerik team
answered on 05 Sep 2013, 05:44 PM
Hello Samuel,

We use a custom implementation of the IDataServiceMetadataProvider interface to produce the metadata needed. The property we should set in order to get this element is ResourceAssociationType.ReferentialConstraint is internal and unfortunately we don't have access to it. It seems that only Microsoft is able to produce this metadata easily. You probably could use reflection to set those internal members but this will not guarantee that it will work in the next version. We cannot support this approach out of the box.

We will try to find better way to deal with the situation. I'll let you know when we have more information.
 

Regards,
Kaloyan Nikolov
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
0
Samuel
Top achievements
Rank 1
answered on 05 Sep 2013, 07:32 PM
Is it not on  AssociationType  which is part of AssociationType.ReferentialConstraint rather ? I couldn't find a ReferentialConstraint on ResourceAssociationType. Not that it makes a difference anyway.
Do you think you can come up with a solution for me  ?  
0
Ivailo
Telerik team
answered on 06 Sep 2013, 09:35 AM
Hello Samuel,

We will probably have to find a way to support this element anyway, since it would make our oData support better and more feature complete. At this point we are still unsure what would be the best way to tackle the limitation Microsoft has imposed, but we will work on that during the next few days and we will let you know once we have a solution or a workaround that can be applied on your side.


Regards,

Ivailo
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
0
Samuel
Top achievements
Rank 1
answered on 24 Sep 2013, 02:22 PM
Hello,

Could I have an update on this? Have you found a workaround for adding the missing node to the metadata ?

Thanks
0
Viktor Zhivkov
Telerik team
answered on 27 Sep 2013, 01:51 PM
Hi Samuel,

So far we have not found a way to set the metadata that you are looking for and there will be no changes in behaviour for the upcoming Q3 2013 release.
I am not sure if we will be able to implement this in the future. Given the limitations of the API that Microsoft have imposed I do not see a way to overcome this issue even given the source code of the OpenAccessMetadataProvider.

I am sorry for the inconvenience. If there is any progress that can resolve the issue you are experiencing I will make sure to contact you with the latest information.

Regards,
Viktor Zhivkov
Telerik
OpenAccess ORM Q3 2013 Beta is available for immediate download in your account. Get it now and play with the latest bits. See what's new >>
0
shail
Top achievements
Rank 1
answered on 14 Jul 2014, 11:10 AM
When refreshing data that is persisted, the OnPropertyChanged event is raised for every property in every data object, this can cause a lot of slowdown
0
shail
Top achievements
Rank 1
answered on 16 Jul 2014, 05:23 AM
As companies begin to implement new Web-based information systems, <a href=http://www.dotlovesdata.com/>Data Analysis</a> technology must satisfy complex new scenarios. Whereas a  of applications accessed data  on the mainframe, now developers building Web-based applications need access to data distributed throughout their organization — on different hardware platforms, different operating systems, and data stores.
0
Kaloyan Nikolov
Telerik team
answered on 17 Jul 2014, 07:49 AM
Hello Shail,

In order to assist you could you describe in more details your scenario. What do you mean by "refreshing data"? What kind of application you refer, is this a service as the current thread is bound to service issues?


Regards,
Kaloyan Nikolov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Web Services
Asked by
Samuel
Top achievements
Rank 1
Answers by
Kaloyan Nikolov
Telerik team
Samuel
Top achievements
Rank 1
Ivailo
Telerik team
Viktor Zhivkov
Telerik team
shail
Top achievements
Rank 1
Share this question
or