Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I share Linq to Entities datacontracts between WCF and Silverlight
    text
    copied!<p>0 vote down star 1</p> <p>I want to be able to share my datacontracts (classes generated in the linq to entities designer are decorated with the [DataContract] attribute.</p> <p>I'm trying to use the architecture as detailed here: <a href="http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2" rel="noreferrer">http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2</a> and trying to reference my interfaces in my silverlight project using the 'Add as link' method as detailed here: <a href="http://www.netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight" rel="noreferrer">http://www.netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight</a></p> <p>The problem I'm having is referencing my service interface in my silverlight project.</p> <p>My solution has the following projects:</p> <p>ORM - contains a Linq to Entities edmx model (namespace: company.client.Service) - the classes in this are decorated with DataContract attribute etc.</p> <p>ServiceInterface - contains the interfaces (namespace company.client.Service) and a reference to the ORM for the classes (Customer etc) being returned</p> <p>Service - contains the implementation of the service interfaces (namespace company.client.Service) and references ServiceInterface and the ORM for the classes.</p> <p>ServiceHost - contains just .svc files as recommended in <a href="http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2" rel="noreferrer">http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2</a></p> <p>WebSLHost - the host for the silverlight app</p> <p>Gui - the silverlight GUI.</p> <p>I want all the of the projects to be standard .net assemblies except for the silverlight gui of course.</p> <p>When I try to add a link to my service interface files (as shown in <a href="http://www.netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight" rel="noreferrer">http://www.netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight</a>) it give a compile error stating that it can't find the ORM and can't identify my entity types.</p> <p>I want to be able to share the datacontract generated by the linq to entities generator with my service and the silverlight client, so if anyone has any ideas I'd appreciate them.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload