Hi I'm back with another question,I have started using EF and I'm having problem with it.
OverView:
I made an EF model ,and found out that one table (named UserRoles) didn't showed up in the EF Model Diagram ,I tried to add it through "Update data model" ,but wizard didn't showed me that table to add (as if it was already added) ,I also tried to refresh model through "Update data model" wizard it was not helpful.
Problem Explained:
The original DB Diagram.
Partial EF Model Diagram
I tried to add it through "Update data model"
I tried to rename an entity in the EF diargram to "UserRoles",an error message popped up.
P.S: I think I have presented the problem well ,but plz let me know of any more info u may need.
Well, your working now with objects, no more sql.
And with EF, many to many relationships don't need a special "entity", but a particular "relation".
In User class, you'll have a list of Roles, and in Roles class, a User list. Which represent perfectly a simple many to many relationship.
If you had at least onother property in your relation table (a "RelationName" string, for - stupid - example), then it would exist in the EF model...
EDIT : Not sure of what you need : that's just the "object" way. Think of the way you would create these classes if you weren't working with a Database : you would do a List of the other in each part of relation. But Sql can't do that (you can't have a "list" in a database), so Sql needs a relation table. But EF is an ORM, so object, not sql.
EDIT 2 :
The way you would create your relation in Code First, but it's quite explicit http://blogs.msdn.com/b/wriju/archive/2011/05/14/code-first-ef-4-1-building-many-to-many-relationship.aspx
For more answers, just google "Entity framework many to many" sould do the trick