Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
195 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...