diff --git a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddict.EntityFrameworkCore.Models.csproj b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddict.EntityFrameworkCore.Models.csproj
index 34675b6b..deb718e4 100644
--- a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddict.EntityFrameworkCore.Models.csproj
+++ b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddict.EntityFrameworkCore.Models.csproj
@@ -2,6 +2,7 @@
net461;netstandard2.0
+ enable
diff --git a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreApplication.cs b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreApplication.cs
index 3188a9ec..5407240e 100644
--- a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreApplication.cs
+++ b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreApplication.cs
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
namespace OpenIddict.EntityFrameworkCore.Models
{
@@ -34,7 +35,10 @@ namespace OpenIddict.EntityFrameworkCore.Models
/// Represents an OpenIddict application.
///
[DebuggerDisplay("Id = {Id.ToString(),nq} ; ClientId = {ClientId,nq} ; Type = {Type,nq}")]
- public class OpenIddictEntityFrameworkCoreApplication where TKey : IEquatable
+ public class OpenIddictEntityFrameworkCoreApplication
+ where TKey : IEquatable
+ where TAuthorization : class
+ where TToken : class
{
///
/// Gets the list of the authorizations associated with this application.
@@ -42,77 +46,74 @@ namespace OpenIddict.EntityFrameworkCore.Models
public virtual ICollection Authorizations { get; } = new HashSet();
///
- /// Gets or sets the client identifier
- /// associated with the current application.
+ /// Gets or sets the client identifier associated with the current application.
///
- public virtual string ClientId { get; set; }
+ public virtual string? ClientId { get; set; }
///
/// Gets or sets the client secret associated with the current application.
/// Note: depending on the application manager used to create this instance,
/// this property may be hashed or encrypted for security reasons.
///
- public virtual string ClientSecret { get; set; }
+ public virtual string? ClientSecret { get; set; }
///
/// Gets or sets the concurrency token.
///
- public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
+ public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
///
- /// Gets or sets the consent type
- /// associated with the current application.
+ /// Gets or sets the consent type associated with the current application.
///
- public virtual string ConsentType { get; set; }
+ public virtual string? ConsentType { get; set; }
///
- /// Gets or sets the display name
- /// associated with the current application.
+ /// Gets or sets the display name associated with the current application.
///
- public virtual string DisplayName { get; set; }
+ public virtual string? DisplayName { get; set; }
///
/// Gets or sets the localized display names
/// associated with the current application,
/// serialized as a JSON object.
///
- public virtual string DisplayNames { get; set; }
+ public virtual string? DisplayNames { get; set; }
///
- /// Gets or sets the unique identifier
- /// associated with the current application.
+ /// Gets or sets the unique identifier associated with the current application.
///
- public virtual TKey Id { get; set; }
+ [AllowNull, MaybeNull]
+ public virtual TKey Id { get; set; } = default!;
///
/// Gets or sets the permissions associated with the
/// current application, serialized as a JSON array.
///
- public virtual string Permissions { get; set; }
+ public virtual string? Permissions { get; set; }
///
/// Gets or sets the logout callback URLs associated with
/// the current application, serialized as a JSON array.
///
- public virtual string PostLogoutRedirectUris { get; set; }
+ public virtual string? PostLogoutRedirectUris { get; set; }
///
/// Gets or sets the additional properties serialized as a JSON object,
/// or null if no bag was associated with the current application.
///
- public virtual string Properties { get; set; }
+ public virtual string? Properties { get; set; }
///
/// Gets or sets the callback URLs associated with the
/// current application, serialized as a JSON array.
///
- public virtual string RedirectUris { get; set; }
+ public virtual string? RedirectUris { get; set; }
///
/// Gets or sets the requirements associated with the
/// current application, serialized as a JSON array.
///
- public virtual string Requirements { get; set; }
+ public virtual string? Requirements { get; set; }
///
/// Gets the list of the tokens associated with this application.
@@ -120,9 +121,8 @@ namespace OpenIddict.EntityFrameworkCore.Models
public virtual ICollection Tokens { get; } = new HashSet();
///
- /// Gets or sets the application type
- /// associated with the current application.
+ /// Gets or sets the application type associated with the current application.
///
- public virtual string Type { get; set; }
+ public virtual string? Type { get; set; }
}
}
\ No newline at end of file
diff --git a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreAuthorization.cs b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreAuthorization.cs
index 6e09f432..697ede91 100644
--- a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreAuthorization.cs
+++ b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreAuthorization.cs
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
namespace OpenIddict.EntityFrameworkCore.Models
{
@@ -34,45 +35,48 @@ namespace OpenIddict.EntityFrameworkCore.Models
/// Represents an OpenIddict authorization.
///
[DebuggerDisplay("Id = {Id.ToString(),nq} ; Subject = {Subject,nq} ; Type = {Type,nq} ; Status = {Status,nq}")]
- public class OpenIddictEntityFrameworkCoreAuthorization where TKey : IEquatable
+ public class OpenIddictEntityFrameworkCoreAuthorization
+ where TKey : IEquatable
+ where TApplication : class
+ where TToken : class
{
///
/// Gets or sets the application associated with the current authorization.
///
- public virtual TApplication Application { get; set; }
+ public virtual TApplication? Application { get; set; }
///
/// Gets or sets the concurrency token.
///
- public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
+ public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
///
- /// Gets or sets the unique identifier
- /// associated with the current authorization.
+ /// Gets or sets the unique identifier associated with the current authorization.
///
- public virtual TKey Id { get; set; }
+ [AllowNull, MaybeNull]
+ public virtual TKey Id { get; set; } = default!;
///
/// Gets or sets the additional properties serialized as a JSON object,
/// or null if no bag was associated with the current authorization.
///
- public virtual string Properties { get; set; }
+ public virtual string? Properties { get; set; }
///
/// Gets or sets the scopes associated with the current
/// authorization, serialized as a JSON array.
///
- public virtual string Scopes { get; set; }
+ public virtual string? Scopes { get; set; }
///
/// Gets or sets the status of the current authorization.
///
- public virtual string Status { get; set; }
+ public virtual string? Status { get; set; }
///
/// Gets or sets the subject associated with the current authorization.
///
- public virtual string Subject { get; set; }
+ public virtual string? Subject { get; set; }
///
/// Gets the list of tokens associated with the current authorization.
@@ -82,6 +86,6 @@ namespace OpenIddict.EntityFrameworkCore.Models
///
/// Gets or sets the type of the current authorization.
///
- public virtual string Type { get; set; }
+ public virtual string? Type { get; set; }
}
}
diff --git a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreScope.cs b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreScope.cs
index a1e0e9ce..3c2525b6 100644
--- a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreScope.cs
+++ b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreScope.cs
@@ -6,6 +6,7 @@
using System;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
namespace OpenIddict.EntityFrameworkCore.Models
{
@@ -30,55 +31,52 @@ namespace OpenIddict.EntityFrameworkCore.Models
///
/// Gets or sets the concurrency token.
///
- public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
+ public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
///
- /// Gets or sets the public description
- /// associated with the current scope.
+ /// Gets or sets the public description associated with the current scope.
///
- public virtual string Description { get; set; }
+ public virtual string? Description { get; set; }
///
/// Gets or sets the localized public descriptions associated
/// with the current scope, serialized as a JSON object.
///
- public virtual string Descriptions { get; set; }
+ public virtual string? Descriptions { get; set; }
///
- /// Gets or sets the display name
- /// associated with the current scope.
+ /// Gets or sets the display name associated with the current scope.
///
- public virtual string DisplayName { get; set; }
+ public virtual string? DisplayName { get; set; }
///
/// Gets or sets the localized display names
/// associated with the current application,
/// serialized as a JSON object.
///
- public virtual string DisplayNames { get; set; }
+ public virtual string? DisplayNames { get; set; }
///
- /// Gets or sets the unique identifier
- /// associated with the current scope.
+ /// Gets or sets the unique identifier associated with the current scope.
///
- public virtual TKey Id { get; set; }
+ [AllowNull, MaybeNull]
+ public virtual TKey Id { get; set; } = default!;
///
- /// Gets or sets the unique name
- /// associated with the current scope.
+ /// Gets or sets the unique name associated with the current scope.
///
- public virtual string Name { get; set; }
+ public virtual string? Name { get; set; }
///
/// Gets or sets the additional properties serialized as a JSON object,
/// or null if no bag was associated with the current scope.
///
- public virtual string Properties { get; set; }
+ public virtual string? Properties { get; set; }
///
/// Gets or sets the resources associated with the
/// current scope, serialized as a JSON array.
///
- public virtual string Resources { get; set; }
+ public virtual string? Resources { get; set; }
}
}
diff --git a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreToken.cs b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreToken.cs
index 27114888..47d0cb5c 100644
--- a/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreToken.cs
+++ b/src/OpenIddict.EntityFrameworkCore.Models/OpenIddictEntityFrameworkCoreToken.cs
@@ -6,6 +6,7 @@
using System;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
namespace OpenIddict.EntityFrameworkCore.Models
{
@@ -33,53 +34,54 @@ namespace OpenIddict.EntityFrameworkCore.Models
/// Represents an OpenIddict token.
///
[DebuggerDisplay("Id = {Id.ToString(),nq} ; Subject = {Subject,nq} ; Type = {Type,nq} ; Status = {Status,nq}")]
- public class OpenIddictEntityFrameworkCoreToken where TKey : IEquatable
+ public class OpenIddictEntityFrameworkCoreToken
+ where TKey : IEquatable
+ where TApplication : class
+ where TAuthorization : class
{
///
/// Gets or sets the application associated with the current token.
///
- public virtual TApplication Application { get; set; }
+ public virtual TApplication? Application { get; set; }
///
/// Gets or sets the authorization associated with the current token.
///
- public virtual TAuthorization Authorization { get; set; }
+ public virtual TAuthorization? Authorization { get; set; }
///
/// Gets or sets the concurrency token.
///
- public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
+ public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
///
- /// Gets or sets the date on which the token
- /// will start to be considered valid.
+ /// Gets or sets the date on which the token will start to be considered valid.
///
public virtual DateTimeOffset? CreationDate { get; set; }
///
- /// Gets or sets the date on which the token
- /// will no longer be considered valid.
+ /// Gets or sets the date on which the token will no longer be considered valid.
///
public virtual DateTimeOffset? ExpirationDate { get; set; }
///
- /// Gets or sets the unique identifier
- /// associated with the current token.
+ /// Gets or sets the unique identifier associated with the current token.
///
- public virtual TKey Id { get; set; }
+ [AllowNull, MaybeNull]
+ public virtual TKey Id { get; set; } = default!;
///
/// Gets or sets the payload of the current token, if applicable.
/// Note: this property is only used for reference tokens
/// and may be encrypted for security reasons.
///
- public virtual string Payload { get; set; }
+ public virtual string? Payload { get; set; }
///
/// Gets or sets the additional properties serialized as a JSON object,
/// or null if no bag was associated with the current token.
///
- public virtual string Properties { get; set; }
+ public virtual string? Properties { get; set; }
///
/// Gets or sets the reference identifier associated
@@ -87,21 +89,21 @@ namespace OpenIddict.EntityFrameworkCore.Models
/// Note: this property is only used for reference tokens
/// and may be hashed or encrypted for security reasons.
///
- public virtual string ReferenceId { get; set; }
+ public virtual string? ReferenceId { get; set; }
///
/// Gets or sets the status of the current token.
///
- public virtual string Status { get; set; }
+ public virtual string? Status { get; set; }
///
/// Gets or sets the subject associated with the current token.
///
- public virtual string Subject { get; set; }
+ public virtual string? Subject { get; set; }
///
/// Gets or sets the type of the current token.
///
- public virtual string Type { get; set; }
+ public virtual string? Type { get; set; }
}
}