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 | 57151c879376374425adb04fb68dad2cf7930df8 (patch) | |
tree | b5f26eabcfa547e76dd7e70ffe0763f3fadf0ad5 /Timeline/Models/DatabaseContext.cs | |
parent | 0c0e0c963458aae3ba9589622fc688388833fa9c (diff) | |
download | timeline-57151c879376374425adb04fb68dad2cf7930df8.tar.gz timeline-57151c879376374425adb04fb68dad2cf7930df8.tar.bz2 timeline-57151c879376374425adb04fb68dad2cf7930df8.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; } - } -} |