Browse Source

Merge pull request #20089 from mseada94/dev

use post condition not null attribute
pull/20117/head
maliming 2 years ago
committed by GitHub
parent
commit
5ad140d64e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 16
      framework/src/Volo.Abp.Core/Volo/Abp/Check.cs

16
framework/src/Volo.Abp.Core/Volo/Abp/Check.cs

@ -10,7 +10,7 @@ public static class Check
{
[ContractAnnotation("value:null => halt")]
public static T NotNull<T>(
T? value,
[System.Diagnostics.CodeAnalysis.NotNull] T? value,
[InvokerParameterName][NotNull] string parameterName)
{
if (value == null)
@ -23,7 +23,7 @@ public static class Check
[ContractAnnotation("value:null => halt")]
public static T NotNull<T>(
T? value,
[System.Diagnostics.CodeAnalysis.NotNull] T? value,
[InvokerParameterName][NotNull] string parameterName,
string message)
{
@ -37,7 +37,7 @@ public static class Check
[ContractAnnotation("value:null => halt")]
public static string NotNull(
string? value,
[System.Diagnostics.CodeAnalysis.NotNull] string? value,
[InvokerParameterName][NotNull] string parameterName,
int maxLength = int.MaxValue,
int minLength = 0)
@ -62,7 +62,7 @@ public static class Check
[ContractAnnotation("value:null => halt")]
public static string NotNullOrWhiteSpace(
string? value,
[System.Diagnostics.CodeAnalysis.NotNull] string? value,
[InvokerParameterName][NotNull] string parameterName,
int maxLength = int.MaxValue,
int minLength = 0)
@ -87,7 +87,7 @@ public static class Check
[ContractAnnotation("value:null => halt")]
public static string NotNullOrEmpty(
string? value,
[System.Diagnostics.CodeAnalysis.NotNull] string? value,
[InvokerParameterName][NotNull] string parameterName,
int maxLength = int.MaxValue,
int minLength = 0)
@ -111,7 +111,9 @@ public static class Check
}
[ContractAnnotation("value:null => halt")]
public static ICollection<T> NotNullOrEmpty<T>(ICollection<T>? value, [InvokerParameterName][NotNull] string parameterName)
public static ICollection<T> NotNullOrEmpty<T>(
[System.Diagnostics.CodeAnalysis.NotNull] ICollection<T>? value,
[InvokerParameterName][NotNull] string parameterName)
{
if (value == null || value.Count <= 0)
{
@ -339,7 +341,7 @@ public static class Check
}
public static T NotDefaultOrNull<T>(
T? value,
[System.Diagnostics.CodeAnalysis.NotNull] T? value,
[InvokerParameterName][NotNull] string parameterName)
where T : struct
{

Loading…
Cancel
Save