aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models/DatabaseContext.cs
blob: 1e89ea82e921e9e39bccf27b8f18a5a297c76c6e (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
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Timeline.Models
{
    [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; }
    }

    public class DatabaseContext : DbContext
    {
        public DatabaseContext(DbContextOptions<DatabaseContext> options)
            : base(options)
        {

        }

        public DbSet<User> Users { get; set; }
    }
}