blob: 9fe046acb7fb7df5b65e14a4b680a969dfbc7c13 (
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.Entities
{
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; }
}
}
|