sockscape/server/DAL/Session.cs

30 lines
758 B
C#
Raw Normal View History

2017-08-23 21:00:44 +00:00
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
2017-06-05 12:20:39 +00:00
2017-08-23 21:00:44 +00:00
namespace SockScape.DAL {
public partial class Session {
[Key, ForeignKey("User")]
public long Id { get; set; }
[Required]
public virtual User User { get; set; }
2017-08-25 21:03:33 +00:00
[Required, Index(IsUnique = true)]
2017-08-22 20:59:41 +00:00
public byte[] Secret { get; set; }
2017-08-23 21:00:44 +00:00
[Required]
public DateTime LastPing { get; set; }
[NotMapped]
public TimeSpan DeltaLastPing
=> DateTime.UtcNow - LastPing;
2017-08-23 21:00:44 +00:00
[Required]
2017-06-06 21:13:25 +00:00
public int ServerId { get; set; }
}
2017-08-23 21:00:44 +00:00
}