From 592cca06f07cd0e69186b96b8ca7810d27bd71e8 Mon Sep 17 00:00:00 2001 From: David McCullough Date: Thu, 12 Nov 2015 20:23:46 -0600 Subject: [PATCH] Rename ApplicationID to Id for better compatibility with EF When subclassing an EF model, the ID field of the parent should be "Id" in order to avoid situations where the model has a different name than the parent (all subclasses). EF expects the ID field to be named "Id" or "ClassNameId". Having the Application model's ID field named as anything other than "Id" prevents best compability with EF. --- samples/Mvc.Server/Startup.cs | 2 +- src/OpenIddict.EF/OpenIddictStore.cs | 2 +- src/OpenIddict.Models/Application.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/Mvc.Server/Startup.cs b/samples/Mvc.Server/Startup.cs index de41f161..d4fbae36 100644 --- a/samples/Mvc.Server/Startup.cs +++ b/samples/Mvc.Server/Startup.cs @@ -73,7 +73,7 @@ namespace Mvc.Server { // Add Mvc.Client to the known applications. if (!context.Applications.Any()) { context.Applications.Add(new Application { - ApplicationID = "myClient", + Id = "myClient", DisplayName = "My client application", RedirectUri = "http://localhost:53507/signin-oidc", LogoutRedirectUri = "http://localhost:53507/", diff --git a/src/OpenIddict.EF/OpenIddictStore.cs b/src/OpenIddict.EF/OpenIddictStore.cs index 70c8461c..92f6c689 100644 --- a/src/OpenIddict.EF/OpenIddictStore.cs +++ b/src/OpenIddict.EF/OpenIddictStore.cs @@ -21,7 +21,7 @@ namespace OpenIddict { } public virtual Task FindApplicationByIdAsync(string identifier, CancellationToken cancellationToken) { - return Applications.SingleOrDefaultAsync(application => application.ApplicationID == identifier, cancellationToken); + return Applications.SingleOrDefaultAsync(application => application.Id == identifier, cancellationToken); } public virtual Task FindApplicationByLogoutRedirectUri(string url, CancellationToken cancellationToken) { diff --git a/src/OpenIddict.Models/Application.cs b/src/OpenIddict.Models/Application.cs index 13b25624..cc9d01ca 100644 --- a/src/OpenIddict.Models/Application.cs +++ b/src/OpenIddict.Models/Application.cs @@ -6,7 +6,7 @@ namespace OpenIddict.Models { public class Application { - public string ApplicationID { get; set; } + public string Id { get; set; } public string DisplayName { get; set; } public string RedirectUri { get; set; } public string LogoutRedirectUri { get; set; }