Setup basic code for login.
This commit is contained in:
parent
a2e6d03d5b
commit
2b521924d0
15 changed files with 381 additions and 6 deletions
28
API/Entities/AppUser.cs
Normal file
28
API/Entities/AppUser.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using API.Entities.Interfaces;
|
||||
|
||||
|
||||
namespace API.Entities
|
||||
{
|
||||
public class AppUser : IHasConcurrencyToken
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public byte[] PasswordHash { get; set; }
|
||||
public byte[] PasswordSalt { get; set; }
|
||||
public DateTime Created { get; set; } = DateTime.Now;
|
||||
public DateTime LastActive { get; set; }
|
||||
|
||||
[ConcurrencyCheck]
|
||||
public uint RowVersion { get; set; }
|
||||
|
||||
public void OnSavingChanges()
|
||||
{
|
||||
RowVersion++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
19
API/Entities/Interfaces/IHasConcurrencyToken.cs
Normal file
19
API/Entities/Interfaces/IHasConcurrencyToken.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
namespace API.Entities.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface abstracting an entity that has a concurrency token.
|
||||
/// </summary>
|
||||
public interface IHasConcurrencyToken
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the version of this row. Acts as a concurrency token.
|
||||
/// </summary>
|
||||
uint RowVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Called when saving changes to this entity.
|
||||
/// </summary>
|
||||
void OnSavingChanges();
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue