aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models/DatabaseContext.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-04-13 13:06:05 +0800
committercrupest <crupest@outlook.com>2019-04-13 13:06:05 +0800
commit962ad53360fb559eaed1ee5a45ef361e6f580bd7 (patch)
tree8ecd711d2b1c97754b321ef0e0bc7de45d303cbd /Timeline/Models/DatabaseContext.cs
parent72890735ced2edc8ccecfed811393e951de5c091 (diff)
parent1d184c3f41da806803c1ee792395eabcd155077d (diff)
downloadtimeline-962ad53360fb559eaed1ee5a45ef361e6f580bd7.tar.gz
timeline-962ad53360fb559eaed1ee5a45ef361e6f580bd7.tar.bz2
timeline-962ad53360fb559eaed1ee5a45ef361e6f580bd7.zip
Merge branch '6-user' into separate
Diffstat (limited to 'Timeline/Models/DatabaseContext.cs')
-rw-r--r--Timeline/Models/DatabaseContext.cs33
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; }
+ }
+}