views:

48

answers:

1

Hi!

I have created a silverlight application, using the silverlight business application template.

I added a ADO.NET entity data model, and created it from scratch in the designer. I then generated a database from the model. The model has a "project" entity and a "client" entity with a many-to-many relationship.

Then, I added a domainservice to my .web project, and selected the entities from my model. In the generated methods for the service, server-side, I have access to the "Client.Projects" property, and also the "Project.Clients" property, but I do not have access to this on the client side, in my silverlight application.

If I change to a one-to-many relationship between the Client and the project, I get access to the property on the silverlight client.

What should I do to get access to the properties on the silverlight client?

Any help would be most appreciated

-Morten

A: 

In a many-to-many relationship, there is a chance that you will have "circular" referenced objects. In other words, one entity has a property of another entity, which in turn has a property reference back to the original entity.

Circular referenced cannot be serialized over a web service or WCF service, so you are probably going to have to break the many-to-many relationship in your model so serialization is possible.

Steve Danner
Hi Steve, thank you for helping me out with my problem!From the designer generated class in the .web project, I can see that both the "Client" class, and the "Project" class is marked with the [DataContractAttribute(IsReference=true)] Wouldn't this solve the problem with circular referenced objects? Circular referenced objects was a problem I had a while ago, when creating a WCF service, and this solved my problem.
Morten