For a project I have to use a legacy database with some cyclic references. The entities are generated as expected, but when I try to use the entities through a WCF Ria service, I got the following error on tables containing cyclic references:
There was an error while trying to serialize parameter http://tempuri.org/:GetPublicationPagesResult. The InnerException message was 'Object graph for type 'xxx.Entities.TblPublicationPage' contains cycles and cannot be serialized if reference tracking is disabled.
After some digging I found that I just can decorate the entities generated by the RLinq file with the IsReference. I did this by using a Metadata class. One disadvantages of doing this, is that I have to put DataMember attributes on all properties. Else the client doesn't see the properties. Isn't there an eleganter solution for this problem? And not by using other DTO's to send over the wire?
I found the following thread to add the DataServiceKey to ADO entities. But if I edit these templates my entities still don't have that attribute. When I change the Specific.ttinclude I can get the DataContract(IsReference = true) attribute but I don't manage to translate this snippet to ttinclude :