Определение перечисления
Код: Выделить всё
public enum CategoryEnum { CAT1, CAT2 }
Код: Выделить всё
[Table("my_table")]
public class MyEntity
{
[Key]
public Guid Id { get; set; }
public CategoryEnum Category { get; set; }
}
Код: Выделить всё
builder.Entity()
.Property(e => e.Category)
.IsRequired()
.HasDefaultValue(CategoryEnum.CAT1);
Подробнее здесь: https://stackoverflow.com/questions/790 ... y-is-a-non
Мобильная версия