小编Hes*_*esh的帖子

EF Core 枚举列表

我正在开发小型应用程序,在 Entity Framework Core 中组织酒店预订。我需要添加有关每个房间的床位数量和类型的信息。我在想,我决定枚举列表比将其存储在单独的表中更好。但我不知道如何实现它

public enum Bed
{
    Single = 1,
    Double = 2,
}

public class Room : IEntity
{
   [Key]
   public int Id { get; set; }
        
   public string RoomIdentifier { get; set; }
   public ICollection<Bed> Beds { get; set; }
        
   public int Floor { get; set; }
   public double Price { get; set; }

   public bool IsFree { get; set; }
   public bool IsOutOfService { get; set; }
   public bool ShouldBeCleaned { get; set; }
        
   public …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework-core .net-core blazor

8
推荐指数
1
解决办法
6859
查看次数

标签 统计

.net-core ×1

blazor ×1

c# ×1

entity-framework-core ×1