diff options
author | crupest <crupest@outlook.com> | 2019-04-13 13:06:05 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-13 13:06:05 +0800 |
commit | 4f16c1d3dff716092e1a26e06e6cfbeec90c027c (patch) | |
tree | 8ecd711d2b1c97754b321ef0e0bc7de45d303cbd /Timeline/Models | |
parent | fac5006e7eaf7f7bc23e92a2b3059d4f1b37fa07 (diff) | |
parent | 401a5b74696c471e5168e421e3de0db1e5f946a8 (diff) | |
download | timeline-4f16c1d3dff716092e1a26e06e6cfbeec90c027c.tar.gz timeline-4f16c1d3dff716092e1a26e06e6cfbeec90c027c.tar.bz2 timeline-4f16c1d3dff716092e1a26e06e6cfbeec90c027c.zip |
Merge branch '6-user' into separate
Diffstat (limited to 'Timeline/Models')
-rw-r--r-- | Timeline/Models/DatabaseContext.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Timeline/Models/DatabaseContext.cs b/Timeline/Models/DatabaseContext.cs new file mode 100644 index 00000000..1e89ea82 --- /dev/null +++ b/Timeline/Models/DatabaseContext.cs @@ -0,0 +1,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; } + } +} |