Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LengthAttribute from .NET 8 if possible #4410

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ public class OrderedGroupsRoutingOptions
/// <summary>
/// Gets or sets the collection of ordered endpoints groups.
/// </summary>
#pragma warning disable CA2227 // Collection properties should be read only
#pragma warning disable IL2026 // Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code
[Required]
#if NET8_0_OR_GREATER
[System.ComponentModel.DataAnnotations.Length(1, int.MaxValue)]
#else
[Microsoft.Shared.Data.Validation.Length(1)]
#endif
[ValidateEnumeratedItems]
#pragma warning disable CA2227 // Collection properties should be read only
#pragma warning disable IL2026 // Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code
public IList<EndpointGroup> Groups { get; set; } = new List<EndpointGroup>();
#pragma warning restore IL2026 // Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code
#pragma warning restore CA2227 // Collection properties should be read only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ public class WeightedGroupsRoutingOptions
/// <summary>
/// Gets or sets the collection of weighted endpoints groups.
/// </summary>
#pragma warning disable CA2227 // Collection properties should be read only
#pragma warning disable IL2026 // Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code
[Required]
#if NET8_0_OR_GREATER
[System.ComponentModel.DataAnnotations.Length(1, int.MaxValue)]
#else
[Microsoft.Shared.Data.Validation.Length(1)]
#endif
[ValidateEnumeratedItems]
#pragma warning disable CA2227 // Collection properties should be read only
#pragma warning disable IL2026 // Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code
public IList<WeightedEndpointGroup> Groups { get; set; } = new List<WeightedEndpointGroup>();
#pragma warning restore IL2026 // Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code
#pragma warning restore CA2227 // Collection properties should be read only
Expand Down