Many-to-many relationship in .NET RIA services
Asked Answered
D

2

8

I have a many-to-many relationship in my database of objects A to B. When i create a domain service the metadata looks fine. A has a collections of Bs, B has a collection of As. So it is correct. However the *.g.cs file generated doesn't have the same relationship.

Is there a way to make it work? I googled some answer to actually generate objects for the association table but i am curious if i can avoid this.

Thanks

Diarrhea answered 20/11, 2009 at 5:21 Comment(2)
How do you generate objects for the association table? EF is not generating that table in my model.Erikerika
@Andrew Garrison you need to have some columns in the association table other than foreign keysDiarrhea
D
4

In the current release/version of RIA Services, you'll need the association table. We will most definitely be looking into this of course for a future release.

That said, I think often many-to-many relationships often have some interesting data associated with the relationship and as such, the middle table often has a real use, rather than existing for the sake of existing.

Dropsy answered 20/11, 2009 at 5:32 Comment(5)
Does this still apply to the v1.0 of ria-services? Because on the server side I can see these relations on the server but not on the client. And adding DTO's everywhere is just so messyOvule
What an absolutely absurd limitation. Many-to-many relationships with no extra data involved are hardly a rare or unusual thing. Every time I try to do something with RIA I run into silly brick walls like this.Acetylate
damn, that brick hit me too ;/Alveta
Nikhil, you should know, is it going to be implemented soon? :) I'm on big project and need to make decision. ThanksMornings
is something changed in SP1? I get 'missing association attributes' with m-t-mGamone
M
2

Till MS implements it in RIA, you can use http://m2m4ria.codeplex.com/ We have used in one of our Silverlight/RIA projects for User/Role (many-to-many) relationship and worked fine.

Myrtia answered 29/3, 2012 at 18:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.