2025-05-26 01:44:26 +02:00

30 lines
784 B
C#

using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace SQLiteEF;
[PrimaryKey("TimeStamp")]
public class TrackedTime
{
[JsonIgnore] public Game Game { get; init; }
[JsonIgnore] public Player Player { get; init; }
public DateTime TimeStamp { get; init; }
public ulong TimePlayed { get; init; }
public TrackedTime(Game game, Player player, ulong timePlayed, DateTime? timeStamp = null)
{
this.Game = game;
this.Player = player;
this.TimeStamp = timeStamp??DateTime.UtcNow;
this.TimePlayed = timePlayed;
}
/// <summary>
/// EF CORE
/// </summary>
internal TrackedTime(ulong timePlayed, DateTime timeStamp)
{
this.TimePlayed = timePlayed;
this.TimeStamp = timeStamp;
}
}