diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-05 18:58:56 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-05 18:58:56 +0800 |
commit | dc1ab11cea249f4ca967f86b115147a63f7c93a5 (patch) | |
tree | b5f26eabcfa547e76dd7e70ffe0763f3fadf0ad5 /Timeline/Models/DatabaseContext.cs | |
parent | 5f5458518df0475fa36af754cae52eb31eb92fa3 (diff) | |
download | timeline-dc1ab11cea249f4ca967f86b115147a63f7c93a5.tar.gz timeline-dc1ab11cea249f4ca967f86b115147a63f7c93a5.tar.bz2 timeline-dc1ab11cea249f4ca967f86b115147a63f7c93a5.zip |
3 things.
1. Exchange Models and Entities namespace.
2. Fix the bug that input with missing field leads to 500.
3. Write unit tests.
Diffstat (limited to 'Timeline/Models/DatabaseContext.cs')
-rw-r--r-- | Timeline/Models/DatabaseContext.cs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/Timeline/Models/DatabaseContext.cs b/Timeline/Models/DatabaseContext.cs deleted file mode 100644 index afd5a333..00000000 --- a/Timeline/Models/DatabaseContext.cs +++ /dev/null @@ -1,42 +0,0 @@ -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; } - } -} |