How can add TablexId and TableyId to a relationships table ( shows up as navigation property on Entity Framework )?


How can add TablexId and TableyId to a relationships table ( shows up as navigation property on Entity Framework )?



I have a Tags table and an Objects table.

A record of their relationships is kept via the ObjectTags table which has two columns. The columns store ObjectId and TagId (from the Tags and Objects tables), and both make up a composite key (can't have TagId and ObjectId twice).

In Entity Framework this table is not mapped as an object but rather enable "navigation" between the main tables. This is very cool, but how to i add to this table? What is the best way?

I add an Object and now i have it's ObjectId. I also add new Tags (reuse the already existing ones) and get their TagId. Now i should add the ObjectId and TagId to this relationship table... but how?


How to make these 2 blocks of almost identical code reusable?

1:

Using ASP.NET MVC 2, StructureMap, Fluent NHibernate, and PostgreSQL
I had to use any thing like this:. ASP.NET MVC application security
db.Items.Where(id => id.Id == newItem.Id).First().Tags.Add(newTag); 
This means. What separates self taught from trained professional devolpers? [closed]In the "db" in the "Items" table where "the Item Id is the one i'm looking for", select it, then go via the navigation property to the "Tags" table and add a "new Tag".. What is causing this DatabaseFileLockedException when trying to open a db4o database in an ASP.NET MVC app? Doing this updates the relationship's ItemTags table with the new ids.. ASP.NET MVC Experiences/Success Stories [2010] :). MVC2 Html Helpers
What is the difference if a Views' “head” tag has attribute “runat” or not?

71 out of 100 based on 46 user ratings 481 reviews

*