diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-21 18:33:07 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-21 18:33:07 +0800 |
commit | 62a3557ab62e1fa188e7498643d7cf0221a18322 (patch) | |
tree | 72f5a8f65048f1495dddff7f12cedbd5eb4e39fc /Timeline/Entities | |
parent | fd95f9abc017575b13a31dd16ac72ef663e984d6 (diff) | |
download | timeline-62a3557ab62e1fa188e7498643d7cf0221a18322.tar.gz timeline-62a3557ab62e1fa188e7498643d7cf0221a18322.tar.bz2 timeline-62a3557ab62e1fa188e7498643d7cf0221a18322.zip |
Add database entity and service.
Diffstat (limited to 'Timeline/Entities')
-rw-r--r-- | Timeline/Entities/DatabaseContext.cs | 4 | ||||
-rw-r--r-- | Timeline/Entities/UserDetail.cs | 26 |
2 files changed, 29 insertions, 1 deletions
diff --git a/Timeline/Entities/DatabaseContext.cs b/Timeline/Entities/DatabaseContext.cs index 6e1fc638..d9815660 100644 --- a/Timeline/Entities/DatabaseContext.cs +++ b/Timeline/Entities/DatabaseContext.cs @@ -28,8 +28,9 @@ namespace Timeline.Entities [Column("version"), Required]
public long Version { get; set; }
- [Required]
public UserAvatar Avatar { get; set; }
+
+ public UserDetailEntity Detail { get; set; }
}
public class DatabaseContext : DbContext
@@ -48,5 +49,6 @@ namespace Timeline.Entities public DbSet<User> Users { get; set; }
public DbSet<UserAvatar> UserAvatars { get; set; }
+ public DbSet<UserDetailEntity> UserDetails { get; set; }
}
}
diff --git a/Timeline/Entities/UserDetail.cs b/Timeline/Entities/UserDetail.cs new file mode 100644 index 00000000..ee829717 --- /dev/null +++ b/Timeline/Entities/UserDetail.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Timeline.Entities
+{
+ [Table("user_details")]
+ public class UserDetailEntity
+ {
+ [Column("id"), Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public long Id { get; set; }
+
+ [Column("qq"), MaxLength(15)]
+ public string QQ { get; set; }
+
+ [Column("email"), MaxLength(30)]
+ public string EMail { get; set; }
+
+ [Column("phone_number"), MaxLength(15)]
+ public string PhoneNumber { get; set; }
+
+ [Column("description")]
+ public string Description { get; set; }
+
+ public long UserId { get; set; }
+ }
+}
|