Browse Source

Add nullable annotations to OpenIddict.MongoDb.Models

pull/1038/head
Kévin Chalet 6 years ago
parent
commit
da75077383
  1. 1
      src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj
  2. 20
      src/OpenIddict.MongoDb.Models/OpenIddictMongoDbApplication.cs
  3. 18
      src/OpenIddict.MongoDb.Models/OpenIddictMongoDbAuthorization.cs
  4. 14
      src/OpenIddict.MongoDb.Models/OpenIddictMongoDbScope.cs
  5. 20
      src/OpenIddict.MongoDb.Models/OpenIddictMongoDbToken.cs

1
src/OpenIddict.MongoDb.Models/OpenIddict.MongoDb.Models.csproj

@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<Nullable>enable</Nullable>
<SignAssembly>false</SignAssembly>
<PublicSign>false</PublicSign>
</PropertyGroup>

20
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.
/// </summary>
[BsonElement("client_id"), BsonRequired]
public virtual string ClientId { get; set; }
[BsonElement("client_id"), BsonIgnoreIfNull]
public virtual string? ClientId { get; set; }
/// <summary>
/// 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.
/// </summary>
[BsonElement("client_secret"), BsonIgnoreIfNull]
public virtual string ClientSecret { get; set; }
public virtual string? ClientSecret { get; set; }
/// <summary>
/// Gets or sets the concurrency token.
/// </summary>
[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();
/// <summary>
/// Gets or sets the consent type
/// associated with the current application.
/// </summary>
[BsonElement("consent_type"), BsonIgnoreIfNull]
public virtual string ConsentType { get; set; }
public virtual string? ConsentType { get; set; }
/// <summary>
/// Gets or sets the display name
/// associated with the current application.
/// </summary>
[BsonElement("display_name"), BsonIgnoreIfNull]
public virtual string DisplayName { get; set; }
public virtual string? DisplayName { get; set; }
/// <summary>
/// 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.
/// </summary>
[BsonElement("properties"), BsonIgnoreIfNull]
public virtual BsonDocument Properties { get; set; }
public virtual BsonDocument? Properties { get; set; }
/// <summary>
/// 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.
/// </summary>
[BsonElement("type"), BsonRequired]
public virtual string Type { get; set; }
[BsonElement("type"), BsonIgnoreIfNull]
public virtual string? Type { get; set; }
}
}

18
src/OpenIddict.MongoDb.Models/OpenIddictMongoDbAuthorization.cs

@ -29,8 +29,8 @@ namespace OpenIddict.MongoDb.Models
/// <summary>
/// Gets or sets the concurrency token.
/// </summary>
[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();
/// <summary>
/// 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.
/// </summary>
[BsonElement("properties"), BsonIgnoreIfNull]
public virtual BsonDocument Properties { get; set; }
public virtual BsonDocument? Properties { get; set; }
/// <summary>
/// Gets or sets the scopes associated with the current authorization.
@ -54,19 +54,19 @@ namespace OpenIddict.MongoDb.Models
/// <summary>
/// Gets or sets the status of the current authorization.
/// </summary>
[BsonElement("status"), BsonRequired]
public virtual string Status { get; set; }
[BsonElement("status"), BsonIgnoreIfNull]
public virtual string? Status { get; set; }
/// <summary>
/// Gets or sets the subject associated with the current authorization.
/// </summary>
[BsonElement("subject"), BsonIgnoreIfDefault]
public virtual string Subject { get; set; }
[BsonElement("subject"), BsonIgnoreIfNull]
public virtual string? Subject { get; set; }
/// <summary>
/// Gets or sets the type of the current authorization.
/// </summary>
[BsonElement("type"), BsonRequired]
public virtual string Type { get; set; }
[BsonElement("type"), BsonIgnoreIfNull]
public virtual string? Type { get; set; }
}
}

14
src/OpenIddict.MongoDb.Models/OpenIddictMongoDbScope.cs

@ -23,15 +23,15 @@ namespace OpenIddict.MongoDb.Models
/// <summary>
/// Gets or sets the concurrency token.
/// </summary>
[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();
/// <summary>
/// Gets or sets the public description
/// associated with the current scope.
/// </summary>
[BsonElement("description"), BsonIgnoreIfNull]
public virtual string Description { get; set; }
public virtual string? Description { get; set; }
/// <summary>
/// Gets or sets the localized public descriptions
@ -46,7 +46,7 @@ namespace OpenIddict.MongoDb.Models
/// associated with the current scope.
/// </summary>
[BsonElement("display_name"), BsonIgnoreIfNull]
public virtual string DisplayName { get; set; }
public virtual string? DisplayName { get; set; }
/// <summary>
/// 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.
/// </summary>
[BsonElement("name"), BsonRequired]
public virtual string Name { get; set; }
[BsonElement("name"), BsonIgnoreIfNull]
public virtual string? Name { get; set; }
/// <summary>
/// Gets or sets the additional properties associated with the current scope.
/// </summary>
[BsonElement("properties"), BsonIgnoreIfNull]
public virtual BsonDocument Properties { get; set; }
public virtual BsonDocument? Properties { get; set; }
/// <summary>
/// Gets or sets the resources associated with the current scope.

20
src/OpenIddict.MongoDb.Models/OpenIddictMongoDbToken.cs

@ -32,8 +32,8 @@ namespace OpenIddict.MongoDb.Models
/// <summary>
/// Gets or sets the concurrency token.
/// </summary>
[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();
/// <summary>
/// Gets or sets the date on which the token
@ -62,13 +62,13 @@ namespace OpenIddict.MongoDb.Models
/// and may be encrypted for security reasons.
/// </summary>
[BsonElement("payload"), BsonIgnoreIfNull]
public virtual string Payload { get; set; }
public virtual string? Payload { get; set; }
/// <summary>
/// Gets or sets the additional properties associated with the current token.
/// </summary>
[BsonElement("properties"), BsonIgnoreIfNull]
public virtual BsonDocument Properties { get; set; }
public virtual BsonDocument? Properties { get; set; }
/// <summary>
/// Gets or sets the reference identifier associated
@ -77,24 +77,24 @@ namespace OpenIddict.MongoDb.Models
/// and may be hashed or encrypted for security reasons.
/// </summary>
[BsonElement("reference_id"), BsonIgnoreIfNull]
public virtual string ReferenceId { get; set; }
public virtual string? ReferenceId { get; set; }
/// <summary>
/// Gets or sets the status of the current token.
/// </summary>
[BsonElement("status"), BsonRequired]
public virtual string Status { get; set; }
[BsonElement("status"), BsonIgnoreIfNull]
public virtual string? Status { get; set; }
/// <summary>
/// Gets or sets the subject associated with the current token.
/// </summary>
[BsonElement("subject"), BsonIgnoreIfDefault]
public virtual string Subject { get; set; }
public virtual string? Subject { get; set; }
/// <summary>
/// Gets or sets the type of the current token.
/// </summary>
[BsonElement("type"), BsonRequired]
public virtual string Type { get; set; }
[BsonElement("type"), BsonIgnoreIfNull]
public virtual string? Type { get; set; }
}
}

Loading…
Cancel
Save