小编SWi*_*lko的帖子

使用LinqtoEntities lambda C#选择项目

我在Visual Studio 2012中使用实体框架代码第一技术这是我的上下文

public class BakingWebContext : DbContext
{
        public DbSet<Recipe> Recipes { get; set; }
        public DbSet<Category> Categories { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我有一个分类

public class Category
{
        [Key]
        public int CategoryId { get; set; }
        [Required]
        public string Name { get; set; }
        public string Description { get; set; }
        public string ImageUrl { get; set; }

        public virtual ICollection<Recipe> Recipes { get; set; }

}
Run Code Online (Sandbox Code Playgroud)

它包含一个虚拟的食谱集合

public class Recipe
{
        [Key]
        public int RecipeId { get; set; …
Run Code Online (Sandbox Code Playgroud)

.net c# linq lambda entity-framework

3
推荐指数
1
解决办法
257
查看次数

标签 统计

.net ×1

c# ×1

entity-framework ×1

lambda ×1

linq ×1