Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
266 views
in Technique[技术] by (71.8m points)

c# - 获取所有相关食谱,而无需在哪里过滤(Get all related recipes, without where-filtering)

This is my Class:

(这是我的课:)

public class Recipe
{
        /// <summary>
        /// PK
        /// </summary> 
        public Guid Id { get; set; }

        [Required]
        // here should be the Id, for the initial (, in its related) recipes
        public Guid BaseId { get; set; }

        /// <summary>
        /// All related recipes
        /// </summary>
        public virtual ICollection<Recipe> RelatedRecipes { get; set; }

        //...
}

Actually I want to get all RelatedRecipes with a single statement, without extra Where(x=>... -filtering.

(实际上,我想用一个语句获取所有RelatedRecipes ,而没有多余的Where(x=>... -filtering)。)

This is my Context:

(这是我的上下文:)

return await context.Recipes.Include(b => b.RelatedRecipes)...

What should I do ?

(我该怎么办 ?)

  ask by StartingAgain translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...