From 11d775659f0cd4420de72fb0d35e009df203a337 Mon Sep 17 00:00:00 2001 From: Joe DeCock Date: Wed, 18 Sep 2024 21:26:30 -0500 Subject: [PATCH] Rename ClientModel The new System.ClientModel library is a dependency that we get from EF, and its namespace name conflicts with our existing class name. There's no good way to resolve the ambiguity, short of just renaming the model. We need to do the same in the templates. (https://github.com/DuendeSoftware/IdentityServer.Templates/issues/56) --- .../Pages/Admin/Clients/ClientRepository.cs | 8 ++++---- hosts/EntityFramework/Pages/Admin/Clients/Edit.cshtml.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hosts/EntityFramework/Pages/Admin/Clients/ClientRepository.cs b/hosts/EntityFramework/Pages/Admin/Clients/ClientRepository.cs index 6ebf78eec..80b075314 100644 --- a/hosts/EntityFramework/Pages/Admin/Clients/ClientRepository.cs +++ b/hosts/EntityFramework/Pages/Admin/Clients/ClientRepository.cs @@ -24,7 +24,7 @@ public class CreateClientModel : ClientSummaryModel public string Secret { get; set; } = default!; } -public class ClientModel : CreateClientModel, IValidatableObject +public class EditClientModel : CreateClientModel, IValidatableObject { [Required] public string AllowedScopes { get; set; } = default!; @@ -91,7 +91,7 @@ public async Task> GetAllAsync(string? filter = return await result.ToArrayAsync(); } - public async Task GetByIdAsync(string id) + public async Task GetByIdAsync(string id) { var client = await _context.Clients .Include(x => x.AllowedGrantTypes) @@ -103,7 +103,7 @@ public async Task> GetAllAsync(string? filter = if (client == null) return null; - return new ClientModel + return new EditClientModel { ClientId = client.ClientId, Name = client.ClientName, @@ -146,7 +146,7 @@ public async Task CreateAsync(CreateClientModel model) await _context.SaveChangesAsync(); } - public async Task UpdateAsync(ClientModel model) + public async Task UpdateAsync(EditClientModel model) { ArgumentNullException.ThrowIfNull(model); var client = await _context.Clients diff --git a/hosts/EntityFramework/Pages/Admin/Clients/Edit.cshtml.cs b/hosts/EntityFramework/Pages/Admin/Clients/Edit.cshtml.cs index 7a41ea695..32d382e5d 100644 --- a/hosts/EntityFramework/Pages/Admin/Clients/Edit.cshtml.cs +++ b/hosts/EntityFramework/Pages/Admin/Clients/Edit.cshtml.cs @@ -19,7 +19,7 @@ public EditModel(ClientRepository repository) } [BindProperty] - public ClientModel InputModel { get; set; } = default!; + public EditClientModel InputModel { get; set; } = default!; [BindProperty] public string? Button { get; set; }