Change id types #114

Merged
kdeng00 merged 4 commits from id_change into master 2025-04-03 21:13:05 -04:00
3 changed files with 10 additions and 2 deletions
Showing only changes of commit 725eab7e7f - Show all commits
+8
View File
@@ -23,6 +23,14 @@ public class UserContext : DbContext
{
modelBuilder.Entity<User>()
.ToTable("User");
modelBuilder.Entity<User>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id)
.HasColumnType("binary(16)"); // **** Map Guid to BINARY(16) ****
});
modelBuilder.Entity<User>()
.Property(u => u.LastLogin).IsRequired(false);
modelBuilder.Entity<User>()
+1 -1
View File
@@ -6,7 +6,7 @@ public class LoginResult : BaseResult
{
#region Properties
[JsonProperty("user_id")]
public int UserId { get; set; }
public Guid UserId { get; set; }
[JsonProperty("username")]
public string? Username { get; set; }
[JsonProperty("token")]
+1 -1
View File
@@ -12,7 +12,7 @@ public class User
[JsonProperty("id")]
[Column("Id")]
[Key]
public int Id { get; set; }
public Guid Id { get; set; }
[JsonProperty("username")]
public string? Username { get; set; }
[JsonProperty("password")]