CoreSync
CoreSync copied to clipboard
Table not syncing in app while others are
I have a table that is based on the following base entity
public abstract class TimerEntity
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public Guid UserId { get; set; }
public Guid CategoryId { get; set; }
public Category Category { get; set; } = null!;
// Tracks the current state of the timer
public TimerState State { get; set; } = TimerState.Stopped;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
public enum TimerState
{
Stopped, // Timer is not running and can be started
Running, // Timer is actively running
Paused // Timer is paused and can be resumed
}
This class is inherited in the following classes
public class SimpleTimerEntity : TimerEntity
{
public TimerMode Mode { get; set; } = TimerMode.CountUp;
// Sync-friendly properties (stored in database)
public long ElapsedTicks { get; set; }
public long? GoalDurationTicks { get; set; }
// For resuming after pause
public DateTime? LastStartedAt { get; set; }
}
public enum TimerMode
{
CountUp, // Stopwatch
CountDown // Countdown from GoalDuration
}
And
public class PomodoroTimerEntity : TimerEntity
{
public int CompletedSessions { get; set; }
public PomodoroState CurrentState { get; set; }
// Sync-friendly properties (stored in database)
public long WorkDurationTicks { get; set; }
public long ShortBreakDurationTicks { get; set; }
public long LongBreakDurationTicks { get; set; }
public long RemainingTicks { get; set; }
public int SessionsBeforeLongBreak { get; set; }
// Runtime tracking
public DateTime? LastStartedAt { get; set; }
}
public enum PomodoroState
{
Work,
ShortBreak,
LongBreak
}
I have this configured in EF to use one table as follows
public DbSet<TimerEntity> Timers { get; set; }
//then
modelBuilder.Entity<TimerEntity>()
.HasDiscriminator<string>("TimerType")
.HasValue<SimpleTimerEntity>("Simple")
.HasValue<PomodoroTimerEntity>("Pomodoro");
And when I sync, it doesn't sync any data to the MAUI client on this particular table while other tables are working...