【发布时间】:2021-09-29 07:39:12
【问题描述】:
我想从 Tag 表中返回仅在 TagRecipe 表中找到的标签。我该怎么做?
var dataTags = await _context.Tags
.Include(tc => tc.TagCategory)
.ToListAsync();
public class Tag
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<TagRecipe> TagRecipes { get; set; }
public int TagCategoryID { get; set; }
public TagCategory TagCategory { get; set; }
}
public class TagRecipe
{
public int TagId { get; set; }
public int RecipeId { get; set; }
public Tag Tag { get; set; }
public Recipe Recipe { get; set; }
}
谢谢
【问题讨论】:
-
能否请您同时发布表格模型的标签和标签食谱?
-
没问题,完成。
标签: c# asp.net-core .net-core entity-framework-core linq-method-syntax