Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Many-to-many relationship in .NET RIA services

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

like image 261
Vitalik Avatar asked Nov 20 '09 05:11

Vitalik


People also ask

How do you solve the problem of many to many relationships?

We’ve also discussed how to approach your physical data model. You’ve learned that many-to-many relationships in relational databases can be solved by implementing a junction table.

What is a many-to-many relationship in analysis services?

Conceptually, a many-to-many dimensional relationship in Analysis Services is equivalent to many-to-many relationships in a relational model, supporting the same kinds of scenarios. Common examples of many-to-many include: Students are enrolled in many courses; each course has many students.

How do I verify that the many-to-many relationships are related?

Verify that all of the tables you plan to use in the many-to-many relationships are related in the DSV through primary key relationships. This is a requirement for establishing a link to the intermediate measure group in a subsequent step.

What are the many-to-many relationships in a fact table?

The many-to-many relationships between the intermediate fact table and both the dimension tables in the relationship and the intermediate dimension creates the many-to-many relationships between members of the primary dimension and measures in the measure group that is specified by the relationship.


2 Answers

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.

like image 73
Nikhil Kothari Avatar answered Oct 21 '22 14:10

Nikhil Kothari


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.

like image 26
Ajay Jadhav Avatar answered Oct 21 '22 13:10

Ajay Jadhav