Browse Source

use post condition not null attribute

pull/20089/head
Mohamed Seada 2 years ago
committed by GitHub
parent
commit
0f6cd42f58
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")] [ContractAnnotation("value:null => halt")]
public static T NotNull<T>( public static T NotNull<T>(
T? value, [System.Diagnostics.CodeAnalysis.NotNull] T? value,
[InvokerParameterName][NotNull] string parameterName) [InvokerParameterName][NotNull] string parameterName)
{ {
if (value == null) if (value == null)
@ -23,7 +23,7 @@ public static class Check
[ContractAnnotation("value:null => halt")] [ContractAnnotation("value:null => halt")]
public static T NotNull<T>( public static T NotNull<T>(
T? value, [System.Diagnostics.CodeAnalysis.NotNull] T? value,
[InvokerParameterName][NotNull] string parameterName, [InvokerParameterName][NotNull] string parameterName,
string message) string message)
{ {
@ -37,7 +37,7 @@ public static class Check
[ContractAnnotation("value:null => halt")] [ContractAnnotation("value:null => halt")]
public static string NotNull( public static string NotNull(
string? value, [System.Diagnostics.CodeAnalysis.NotNull] string? value,
[InvokerParameterName][NotNull] string parameterName, [InvokerParameterName][NotNull] string parameterName,
int maxLength = int.MaxValue, int maxLength = int.MaxValue,
int minLength = 0) int minLength = 0)
@ -62,7 +62,7 @@ public static class Check
[ContractAnnotation("value:null => halt")] [ContractAnnotation("value:null => halt")]
public static string NotNullOrWhiteSpace( public static string NotNullOrWhiteSpace(
string? value, [System.Diagnostics.CodeAnalysis.NotNull] string? value,
[InvokerParameterName][NotNull] string parameterName, [InvokerParameterName][NotNull] string parameterName,
int maxLength = int.MaxValue, int maxLength = int.MaxValue,
int minLength = 0) int minLength = 0)
@ -87,7 +87,7 @@ public static class Check
[ContractAnnotation("value:null => halt")] [ContractAnnotation("value:null => halt")]
public static string NotNullOrEmpty( public static string NotNullOrEmpty(
string? value, [System.Diagnostics.CodeAnalysis.NotNull] string? value,
[InvokerParameterName][NotNull] string parameterName, [InvokerParameterName][NotNull] string parameterName,
int maxLength = int.MaxValue, int maxLength = int.MaxValue,
int minLength = 0) int minLength = 0)
@ -111,7 +111,9 @@ public static class Check
} }
[ContractAnnotation("value:null => halt")] [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) if (value == null || value.Count <= 0)
{ {
@ -339,7 +341,7 @@ public static class Check
} }
public static T NotDefaultOrNull<T>( public static T NotDefaultOrNull<T>(
T? value, [System.Diagnostics.CodeAnalysis.NotNull] T? value,
[InvokerParameterName][NotNull] string parameterName) [InvokerParameterName][NotNull] string parameterName)
where T : struct where T : struct
{ {

Loading…
Cancel
Save