blob: 2e33bf8da431a6eef7fc9fbd7d5e603e4b09e2c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Timeline.Models
{
public static class UserRoles
{
public const string Admin = "admin";
public const string User = "user";
}
[Table("user")]
public class User
{
[Column("id"), Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
[Column("name"), Required]
public string Name { get; set; }
[Column("password"), Required]
public string EncryptedPassword { get; set; }
[Column("roles"), Required]
public string RoleString { get; set; }
[Column("version"), Required]
public long Version { get; set; }
}
public class DatabaseContext : DbContext
{
public DatabaseContext(DbContextOptions<DatabaseContext> options)
: base(options)
{
}
public DbSet<User> Users { get; set; }
}
}
|