2017-06-02 21:02:48 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2017-08-22 20:59:41 +00:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2017-06-02 21:02:48 +00:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
using System.Linq;
|
2017-06-06 21:13:25 +00:00
|
|
|
|
using System.Net;
|
2017-06-02 21:02:48 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2017-07-22 19:27:41 +00:00
|
|
|
|
namespace SockScape.DAL {
|
2017-06-05 12:20:39 +00:00
|
|
|
|
public partial class Origin {
|
2017-06-02 21:02:48 +00:00
|
|
|
|
public long Id { get; set; }
|
|
|
|
|
|
2017-06-05 12:20:39 +00:00
|
|
|
|
[ForeignKey("User")]
|
2017-08-22 20:59:41 +00:00
|
|
|
|
[Index("IX_RawIp_UserId_Unique", 1, IsUnique = true)]
|
2017-06-02 21:02:48 +00:00
|
|
|
|
public long UserId { get; set; }
|
|
|
|
|
public virtual User User { get; set; }
|
|
|
|
|
|
2017-08-22 20:59:41 +00:00
|
|
|
|
[Index("IX_RawIp_UserId_Unique", 2, IsUnique = true)]
|
|
|
|
|
[MaxLength(16)]
|
|
|
|
|
protected byte[] RawIp { get; set; }
|
2017-08-21 21:03:32 +00:00
|
|
|
|
|
|
|
|
|
[NotMapped]
|
2017-06-06 21:13:25 +00:00
|
|
|
|
public IPAddress Ip {
|
2017-08-22 20:59:41 +00:00
|
|
|
|
get => new IPAddress(RawIp);
|
|
|
|
|
set => RawIp = value.MapToIPv6().GetAddressBytes();
|
2017-06-06 21:13:25 +00:00
|
|
|
|
}
|
2017-06-02 21:02:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|