Пишу приложение на C# WPF типа будильник. Будильники хранятся в базе SqLite.
Использую Microsoft.EntityFrameworkCore.Sqlite
Подключение
public class AlarmContext : DbContext
{
public DbSet<AlarmModel> AlarmModels { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
_ = optionsBuilder.UseSqlite("Data Source = alarm.db");
}
}
Модель
public class AlarmModel
{
public int Id { get; set; }
public DateTime Date { get; set; }
public int Hours { get; set; }
public int Minutes { get; set; }
public bool Mo { get; set; }
public bool Tu { get; set; }
public bool We { get; set; }
public bool Th { get; set; }
public bool Fr { get; set; }
public bool Sa { get; set; }
public bool Su { get; set; }
}
Ну и сам вопрос Как можно сгруппировать дни недели что-то типа таково
public class AlarmModel
{
public int Id { get; set; }
public DateTime Date { get; set; }
public int Hours { get; set; }
public int Minutes { get; set; }
public DayWeek DayWeek { get; set; }
}
public class DayWeek
{
public int Id { get; set; }
public bool Mo { get; set; }
public bool Tu { get; set; }
public bool We { get; set; }
public bool Th { get; set; }
public bool Fr { get; set; }
public bool Sa { get; set; }
public bool Su { get; set; }
}
Сам пробовал получается DayWeek всегда NULL Это мое первое приложение c Б.Д. поэтому сильно не ругайтесь