diff --git a/src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj b/src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj
index bfde10fb..c3d5b044 100644
--- a/src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj
+++ b/src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj
@@ -2,6 +2,7 @@
net461;netstandard2.0
+ enable
false
false
diff --git a/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbApplication.cs b/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbApplication.cs
index 148a5252..0e1a6498 100644
--- a/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbApplication.cs
+++ b/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbApplication.cs
@@ -24,8 +24,8 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the client identifier
/// associated with the current application.
///
- [BsonElement("client_id"), BsonRequired]
- public virtual string ClientId { get; set; }
+ [BsonElement("client_id"), BsonIgnoreIfNull]
+ public virtual string? ClientId { get; set; }
///
/// Gets or sets the client secret associated with the current application.
@@ -33,27 +33,27 @@ namespace OpenIddict.MongoDb.Models
/// this property may be hashed or encrypted for security reasons.
///
[BsonElement("client_secret"), BsonIgnoreIfNull]
- public virtual string ClientSecret { get; set; }
+ public virtual string? ClientSecret { get; set; }
///
/// Gets or sets the concurrency token.
///
- [BsonElement("concurrency_token"), BsonRequired]
- public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
+ [BsonElement("concurrency_token"), BsonIgnoreIfNull]
+ public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
///
/// Gets or sets the consent type
/// associated with the current application.
///
[BsonElement("consent_type"), BsonIgnoreIfNull]
- public virtual string ConsentType { get; set; }
+ public virtual string? ConsentType { get; set; }
///
/// Gets or sets the display name
/// associated with the current application.
///
[BsonElement("display_name"), BsonIgnoreIfNull]
- public virtual string DisplayName { get; set; }
+ public virtual string? DisplayName { get; set; }
///
/// Gets or sets the localized display names
@@ -86,7 +86,7 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the additional properties associated with the current application.
///
[BsonElement("properties"), BsonIgnoreIfNull]
- public virtual BsonDocument Properties { get; set; }
+ public virtual BsonDocument? Properties { get; set; }
///
/// Gets or sets the callback URLs associated with the current application.
@@ -104,7 +104,7 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the application type
/// associated with the current application.
///
- [BsonElement("type"), BsonRequired]
- public virtual string Type { get; set; }
+ [BsonElement("type"), BsonIgnoreIfNull]
+ public virtual string? Type { get; set; }
}
}
\ No newline at end of file
diff --git a/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbAuthorization.cs b/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbAuthorization.cs
index f3b646b4..afa171c6 100644
--- a/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbAuthorization.cs
+++ b/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbAuthorization.cs
@@ -29,8 +29,8 @@ namespace OpenIddict.MongoDb.Models
///
/// Gets or sets the concurrency token.
///
- [BsonElement("concurrency_token"), BsonRequired]
- public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
+ [BsonElement("concurrency_token"), BsonIgnoreIfNull]
+ public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
///
/// Gets or sets the unique identifier
@@ -43,7 +43,7 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the additional properties associated with the current authorization.
///
[BsonElement("properties"), BsonIgnoreIfNull]
- public virtual BsonDocument Properties { get; set; }
+ public virtual BsonDocument? Properties { get; set; }
///
/// Gets or sets the scopes associated with the current authorization.
@@ -54,19 +54,19 @@ namespace OpenIddict.MongoDb.Models
///
/// Gets or sets the status of the current authorization.
///
- [BsonElement("status"), BsonRequired]
- public virtual string Status { get; set; }
+ [BsonElement("status"), BsonIgnoreIfNull]
+ public virtual string? Status { get; set; }
///
/// Gets or sets the subject associated with the current authorization.
///
- [BsonElement("subject"), BsonIgnoreIfDefault]
- public virtual string Subject { get; set; }
+ [BsonElement("subject"), BsonIgnoreIfNull]
+ public virtual string? Subject { get; set; }
///
/// Gets or sets the type of the current authorization.
///
- [BsonElement("type"), BsonRequired]
- public virtual string Type { get; set; }
+ [BsonElement("type"), BsonIgnoreIfNull]
+ public virtual string? Type { get; set; }
}
}
diff --git a/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbScope.cs b/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbScope.cs
index f23ee263..55488014 100644
--- a/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbScope.cs
+++ b/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbScope.cs
@@ -23,15 +23,15 @@ namespace OpenIddict.MongoDb.Models
///
/// Gets or sets the concurrency token.
///
- [BsonElement("concurrency_token"), BsonRequired]
- public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
+ [BsonElement("concurrency_token"), BsonIgnoreIfNull]
+ public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
///
/// Gets or sets the public description
/// associated with the current scope.
///
[BsonElement("description"), BsonIgnoreIfNull]
- public virtual string Description { get; set; }
+ public virtual string? Description { get; set; }
///
/// Gets or sets the localized public descriptions
@@ -46,7 +46,7 @@ namespace OpenIddict.MongoDb.Models
/// associated with the current scope.
///
[BsonElement("display_name"), BsonIgnoreIfNull]
- public virtual string DisplayName { get; set; }
+ public virtual string? DisplayName { get; set; }
///
/// Gets or sets the localized display names
@@ -67,14 +67,14 @@ namespace OpenIddict.MongoDb.Models
/// Gets or sets the unique name
/// associated with the current scope.
///
- [BsonElement("name"), BsonRequired]
- public virtual string Name { get; set; }
+ [BsonElement("name"), BsonIgnoreIfNull]
+ public virtual string? Name { get; set; }
///
/// Gets or sets the additional properties associated with the current scope.
///
[BsonElement("properties"), BsonIgnoreIfNull]
- public virtual BsonDocument Properties { get; set; }
+ public virtual BsonDocument? Properties { get; set; }
///
/// Gets or sets the resources associated with the current scope.
diff --git a/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbToken.cs b/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbToken.cs
index 6375b119..01731de1 100644
--- a/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbToken.cs
+++ b/src/OpenIddict.MongoDb.Models/OpenIddictMongoDbToken.cs
@@ -32,8 +32,8 @@ namespace OpenIddict.MongoDb.Models
///
/// Gets or sets the concurrency token.
///
- [BsonElement("concurrency_token"), BsonRequired]
- public virtual string ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
+ [BsonElement("concurrency_token"), BsonIgnoreIfNull]
+ public virtual string? ConcurrencyToken { get; set; } = Guid.NewGuid().ToString();
///
/// Gets or sets the date on which the token
@@ -62,13 +62,13 @@ namespace OpenIddict.MongoDb.Models
/// and may be encrypted for security reasons.
///
[BsonElement("payload"), BsonIgnoreIfNull]
- public virtual string Payload { get; set; }
+ public virtual string? Payload { get; set; }
///
/// Gets or sets the additional properties associated with the current token.
///
[BsonElement("properties"), BsonIgnoreIfNull]
- public virtual BsonDocument Properties { get; set; }
+ public virtual BsonDocument? Properties { get; set; }
///
/// Gets or sets the reference identifier associated
@@ -77,24 +77,24 @@ namespace OpenIddict.MongoDb.Models
/// and may be hashed or encrypted for security reasons.
///
[BsonElement("reference_id"), BsonIgnoreIfNull]
- public virtual string ReferenceId { get; set; }
+ public virtual string? ReferenceId { get; set; }
///
/// Gets or sets the status of the current token.
///
- [BsonElement("status"), BsonRequired]
- public virtual string Status { get; set; }
+ [BsonElement("status"), BsonIgnoreIfNull]
+ public virtual string? Status { get; set; }
///
/// Gets or sets the subject associated with the current token.
///
[BsonElement("subject"), BsonIgnoreIfDefault]
- public virtual string Subject { get; set; }
+ public virtual string? Subject { get; set; }
///
/// Gets or sets the type of the current token.
///
- [BsonElement("type"), BsonRequired]
- public virtual string Type { get; set; }
+ [BsonElement("type"), BsonIgnoreIfNull]
+ public virtual string? Type { get; set; }
}
}