I am developing a ASP.NET MVC project. In my project, I am using Entity Framework code first approach. But I am having a problem with that.
This is item class
class Item{
  public int Id { get; set; }
  .
  .
  .
  public virtual ICollection<Category> Categories { get; set; }
}
This is category class
public class Category{
   public int Id{ get; set; }
   public int Name { get; set; }
   public virtual ICollection<Item> Items { get; set; }
}
As you can see above they are in many-to-many relationship. What I want to do is as below.
var item = db.find(2); //I retrieve a single item
var item.Categories; // this is how I get all categories of that item
item.Categories.Select(x=>x.Name).Join(?); // I want to retrieve all category names of that item as CSV value.
How can I achieve this?