diff options
author | 杨宇千 <crupest@outlook.com> | 2019-04-13 15:47:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-13 15:47:40 +0800 |
commit | 56c51bdf844ce1e3642dcdc4099187e7e57008c7 (patch) | |
tree | 1aa37565aad734b604eb94ed3a62db2308f4b30d /Timeline/Models | |
parent | 19cae15eba2bcede41b818e1b8ab7fd5ac92eb05 (diff) | |
parent | 108ea333534445a8c76d4db632ebf21abf426c71 (diff) | |
download | timeline-56c51bdf844ce1e3642dcdc4099187e7e57008c7.tar.gz timeline-56c51bdf844ce1e3642dcdc4099187e7e57008c7.tar.bz2 timeline-56c51bdf844ce1e3642dcdc4099187e7e57008c7.zip |
Merge pull request #20 from crupest/separate
Separate front end and back end.
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; } + } +} |