I want to implement the below mentioned problem in Entity Framework.
I have 2 tables( below are their simplified versions)
items table
itemId,itemName
tags table
tagId,tagName
my logic is, an item can have more than one tag and a tag can have more than one item related to it, so I have added many to many relation (please correct me here, if I am wrong)
I have created model (edmx file) and database from it.
I have written code for adding data to my sample tables, and its working fine. Below is sample data
itemId itemName ---items table 1 | fish 2 | cell phone tagId tagName ------tags table 1 | eatable 2 | electronics 3 | non veg
I need to know how to write these 3 queries
- add relation between tag and item e.g. add tags "eatables", "nonveg" to item "fish"
- get all tags related to an item (eg: fish)
- get all tags not related to an item (eg: fish)