From dc1ab11cea249f4ca967f86b115147a63f7c93a5 Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Mon, 5 Aug 2019 18:58:56 +0800 Subject: 3 things. 1. Exchange Models and Entities namespace. 2. Fix the bug that input with missing field leads to 500. 3. Write unit tests. --- Timeline/Models/DatabaseContext.cs | 42 -------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 Timeline/Models/DatabaseContext.cs (limited to 'Timeline/Models/DatabaseContext.cs') 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 options) - : base(options) - { - - } - - public DbSet Users { get; set; } - } -} -- cgit v1.2.3