Browse Source

Enable nullable annotations for Volo.Abp.AspNetCore.Mvc

pull/17094/head
liangshiwei 3 years ago
parent
commit
4538e0eee4
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Builder/AbpAspNetCoreMvcApplicationBuilderExtensions.cs
  2. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Mvc/Abstractions/ActionDescriptorExtensions.cs
  3. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
  4. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpActionContextExtensions.cs
  5. 20
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs
  6. 14
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpControllerBase.cs
  7. 12
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpDataAnnotationAutoLocalizationMetadataDetailsProvider.cs
  8. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs
  9. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs
  10. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs
  11. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AspNetCoreAbpAntiForgeryManager.cs
  12. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs
  13. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs
  14. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationLocalizationAppService.cs
  15. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs
  16. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyAttributeDtoFactory.cs
  17. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs
  18. 19
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
  19. 8
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProviderOptions.cs
  20. 8
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs
  21. 10
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs
  22. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs
  23. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/AbpRemoteStreamContentModelBinder.cs
  24. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/AbpRemoteStreamContentModelBinderProvider.cs
  25. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs
  26. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs
  27. 27
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs
  28. 20
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSetting.cs
  29. 3
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSettingList.cs
  30. 16
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalRouteBuilder.cs
  31. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/IConventionalRouteBuilder.cs
  32. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DataAnnotations/AbpValidationAttributeAdapterProvider.cs
  33. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DataAnnotations/DynamicMaxLengthAttributeAdapter.cs
  34. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DataAnnotations/DynamicRangeAttributeAdapter.cs
  35. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DataAnnotations/DynamicStringLengthAttributeAdapter.cs
  36. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs
  37. 14
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs
  38. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs
  39. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs
  40. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpMvcAttributeValidationResultProvider.cs
  41. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinderProvider.cs
  42. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpExtraPropertiesDictionaryModelBinderProvider.cs
  43. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpExtraPropertyModelBinder.cs
  44. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/ExtraPropertyBindingHelper.cs
  45. 14
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
  46. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs
  47. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs
  48. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Utils/ArrayMatcher.cs
  49. 4
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs
  50. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Versioning/HttpContextRequestedApiVersion.cs
  51. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/ObjectExtending/ObjectExtensionPropertyInfoAspNetCoreMvcExtensions.cs

2
framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Builder/AbpAspNetCoreMvcApplicationBuilderExtensions.cs

@ -18,7 +18,7 @@ public static class AbpAspNetCoreMvcApplicationBuilderExtensions
[Obsolete("Use app.UseConfiguredEndpoints(...) extension method instead!")]
public static IApplicationBuilder UseMvcWithDefaultRouteAndArea(
this IApplicationBuilder app,
Action<IEndpointRouteBuilder> additionalConfigurationAction = null)
Action<IEndpointRouteBuilder>? additionalConfigurationAction = null)
{
return app.UseConfiguredEndpoints(additionalConfigurationAction);
}

4
framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Mvc/Abstractions/ActionDescriptorExtensions.cs

@ -16,7 +16,7 @@ public static class ActionDescriptorExtensions
throw new AbpException($"{nameof(actionDescriptor)} should be type of {typeof(ControllerActionDescriptor).AssemblyQualifiedName}");
}
return actionDescriptor as ControllerActionDescriptor;
return (actionDescriptor as ControllerActionDescriptor)!;
}
public static MethodInfo GetMethodInfo(this ActionDescriptor actionDescriptor)
@ -51,6 +51,6 @@ public static class ActionDescriptorExtensions
throw new AbpException($"{nameof(actionDescriptor)} should be type of {typeof(PageActionDescriptor).AssemblyQualifiedName}");
}
return actionDescriptor as PageActionDescriptor;
return (actionDescriptor as PageActionDescriptor)!;
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<AssemblyName>Volo.Abp.AspNetCore.Mvc</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc</PackageId>

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpActionContextExtensions.cs

@ -11,7 +11,7 @@ public static class AbpActionContextExtensions
return context.HttpContext.RequestServices.GetRequiredService<T>();
}
public static T GetService<T>(this FilterContext context, T defaultValue = default)
public static T? GetService<T>(this FilterContext context, T? defaultValue = default)
where T : class
{
return context.HttpContext.RequestServices.GetService<T>() ?? defaultValue;

20
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs

@ -23,14 +23,14 @@ namespace Volo.Abp.AspNetCore.Mvc;
public abstract class AbpController : Controller, IAvoidDuplicateCrossCuttingConcerns
{
public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!;
[Obsolete("Use LazyServiceProvider instead.")]
public IServiceProvider ServiceProvider { get; set; }
public IServiceProvider ServiceProvider { get; set; } = default!;
protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService<IUnitOfWorkManager>();
protected Type ObjectMapperContext { get; set; }
protected Type? ObjectMapperContext { get; set; }
protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService<IObjectMapper>(provider =>
ObjectMapperContext == null
? provider.GetRequiredService<IObjectMapper>()
@ -40,7 +40,7 @@ public abstract class AbpController : Controller, IAvoidDuplicateCrossCuttingCon
protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService<ILoggerFactory>();
protected ILogger Logger => LazyServiceProvider.LazyGetService<ILogger>(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance);
protected ILogger Logger => LazyServiceProvider.LazyGetService<ILogger>(provider => LoggerFactory?.CreateLogger(GetType().FullName!) ?? NullLogger.Instance);
protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService<ICurrentUser>();
@ -48,7 +48,7 @@ public abstract class AbpController : Controller, IAvoidDuplicateCrossCuttingCon
protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetRequiredService<IAuthorizationService>();
protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current;
protected IUnitOfWork? CurrentUnitOfWork => UnitOfWorkManager?.Current;
protected IClock Clock => LazyServiceProvider.LazyGetRequiredService<IClock>();
@ -70,16 +70,16 @@ public abstract class AbpController : Controller, IAvoidDuplicateCrossCuttingCon
return _localizer;
}
}
private IStringLocalizer _localizer;
private IStringLocalizer? _localizer;
protected Type LocalizationResource {
protected Type? LocalizationResource {
get => _localizationResource;
set {
_localizationResource = value;
_localizer = null;
}
}
private Type _localizationResource = typeof(DefaultResource);
private Type? _localizationResource = typeof(DefaultResource);
public List<string> AppliedCrossCuttingConcerns { get; } = new List<string>();
@ -104,12 +104,12 @@ public abstract class AbpController : Controller, IAvoidDuplicateCrossCuttingCon
return localizer;
}
protected virtual RedirectResult RedirectSafely(string returnUrl, string returnUrlHash = null)
protected virtual RedirectResult RedirectSafely(string returnUrl, string? returnUrlHash = null)
{
return Redirect(GetRedirectUrl(returnUrl, returnUrlHash));
}
protected virtual string GetRedirectUrl(string returnUrl, string returnUrlHash = null)
protected virtual string GetRedirectUrl(string returnUrl, string? returnUrlHash = null)
{
returnUrl = NormalizeReturnUrl(returnUrl);

14
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpControllerBase.cs

@ -22,11 +22,11 @@ namespace Volo.Abp.AspNetCore.Mvc;
public abstract class AbpControllerBase : ControllerBase, IAvoidDuplicateCrossCuttingConcerns
{
public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!;
protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService<IUnitOfWorkManager>();
protected Type ObjectMapperContext { get; set; }
protected Type? ObjectMapperContext { get; set; }
protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService<IObjectMapper>(provider =>
ObjectMapperContext == null
? provider.GetRequiredService<IObjectMapper>()
@ -36,7 +36,7 @@ public abstract class AbpControllerBase : ControllerBase, IAvoidDuplicateCrossCu
protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService<ILoggerFactory>();
protected ILogger Logger => LazyServiceProvider.LazyGetService<ILogger>(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance);
protected ILogger Logger => LazyServiceProvider.LazyGetService<ILogger>(provider => LoggerFactory?.CreateLogger(GetType().FullName!) ?? NullLogger.Instance);
protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService<ICurrentUser>();
@ -44,7 +44,7 @@ public abstract class AbpControllerBase : ControllerBase, IAvoidDuplicateCrossCu
protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetRequiredService<IAuthorizationService>();
protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current;
protected IUnitOfWork? CurrentUnitOfWork => UnitOfWorkManager?.Current;
protected IClock Clock => LazyServiceProvider.LazyGetRequiredService<IClock>();
@ -64,16 +64,16 @@ public abstract class AbpControllerBase : ControllerBase, IAvoidDuplicateCrossCu
return _localizer;
}
}
private IStringLocalizer _localizer;
private IStringLocalizer? _localizer;
protected Type LocalizationResource {
protected Type? LocalizationResource {
get => _localizationResource;
set {
_localizationResource = value;
_localizer = null;
}
}
private Type _localizationResource = typeof(DefaultResource);
private Type? _localizationResource = typeof(DefaultResource);
public List<string> AppliedCrossCuttingConcerns { get; } = new List<string>();

12
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpDataAnnotationAutoLocalizationMetadataDetailsProvider.cs

@ -17,13 +17,13 @@ public class AbpDataAnnotationAutoLocalizationMetadataDetailsProvider : IDisplay
private readonly Lazy<IStringLocalizerFactory> _stringLocalizerFactory;
private readonly Lazy<IOptions<MvcDataAnnotationsLocalizationOptions>> _localizationOptions;
private readonly ConcurrentDictionary<DisplayMetadataProviderContext, string> _displayNameKeys;
private readonly ConcurrentDictionary<DisplayMetadataProviderContext, string?> _displayNameKeys;
public AbpDataAnnotationAutoLocalizationMetadataDetailsProvider(IServiceCollection services)
{
_stringLocalizerFactory = services.GetRequiredServiceLazy<IStringLocalizerFactory>();
_localizationOptions = services.GetRequiredServiceLazy<IOptions<MvcDataAnnotationsLocalizationOptions>>();
_displayNameKeys = new ConcurrentDictionary<DisplayMetadataProviderContext, string>();
_displayNameKeys = new ConcurrentDictionary<DisplayMetadataProviderContext, string?>();
}
public virtual void CreateDisplayMetadata(DisplayMetadataProviderContext context)
@ -58,11 +58,11 @@ public class AbpDataAnnotationAutoLocalizationMetadataDetailsProvider : IDisplay
displayMetadata.DisplayName = () =>
{
var key = _displayNameKeys.GetOrAdd(context, _ => GetDisplayNameKey(context, localizer));
return key != null ? localizer[key] : null;
return (key != null ? localizer[key] : null)!;
};
}
protected virtual string GetDisplayNameKey(DisplayMetadataProviderContext context, IStringLocalizer localizer)
protected virtual string? GetDisplayNameKey(DisplayMetadataProviderContext context, IStringLocalizer localizer)
{
/*
* DisplayName:ClassName:PropertyName
@ -71,7 +71,7 @@ public class AbpDataAnnotationAutoLocalizationMetadataDetailsProvider : IDisplay
* PropertyName
*/
LocalizedString localizedString = null;
LocalizedString? localizedString = null;
if (context.Key.ContainerType != null)
{
@ -102,7 +102,7 @@ public class AbpDataAnnotationAutoLocalizationMetadataDetailsProvider : IDisplay
if (localizedString.ResourceNotFound)
{
localizedString = localizer[context.Key.Name];
localizedString = localizer[context.Key.Name!];
if (!localizedString.ResourceNotFound)
{
return localizedString.Name;

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs

@ -8,12 +8,12 @@ namespace Volo.Abp.AspNetCore.Mvc;
public abstract class AbpViewComponent : ViewComponent
{
public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!;
[Obsolete("Use LazyServiceProvider instead.")]
public IServiceProvider ServiceProvider { get; set; }
public IServiceProvider ServiceProvider { get; set; } = default!;
protected Type ObjectMapperContext { get; set; }
protected Type? ObjectMapperContext { get; set; }
protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService<IObjectMapper>(provider =>
ObjectMapperContext == null

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryCookieNameProvider.cs

@ -17,7 +17,7 @@ public class AbpAntiForgeryCookieNameProvider : ITransientDependency
_abpAntiForgeryOptions = abpAntiForgeryOptions.Value;
}
public virtual string GetAuthCookieNameOrNull()
public virtual string? GetAuthCookieNameOrNull()
{
if (_abpAntiForgeryOptions.AuthCookieSchemaName == null)
{
@ -27,7 +27,7 @@ public class AbpAntiForgeryCookieNameProvider : ITransientDependency
return _namedOptionsAccessor.Get(_abpAntiForgeryOptions.AuthCookieSchemaName)?.Cookie?.Name;
}
public virtual string GetAntiForgeryCookieNameOrNull()
public virtual string? GetAntiForgeryCookieNameOrNull()
{
return _abpAntiForgeryOptions.TokenCookie.Name;
}

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AbpAntiForgeryOptions.cs

@ -17,7 +17,7 @@ public class AbpAntiForgeryOptions
/// Used to find auth cookie when validating Anti Forgery token.
/// Default value: "Identity.Application".
/// </summary>
public string AuthCookieSchemaName { get; set; }
public string? AuthCookieSchemaName { get; set; }
/// <summary>
/// Default value: true.
@ -34,7 +34,7 @@ public class AbpAntiForgeryOptions
get => _autoValidateFilter;
set => _autoValidateFilter = Check.NotNull(value, nameof(value));
}
private Predicate<Type> _autoValidateFilter;
private Predicate<Type> _autoValidateFilter = default!;
/// <summary>
/// Default methods: "GET", "HEAD", "TRACE", "OPTIONS".
@ -44,7 +44,7 @@ public class AbpAntiForgeryOptions
get => _autoValidateIgnoredHttpMethods;
set => _autoValidateIgnoredHttpMethods = Check.NotNull(value, nameof(value));
}
private HashSet<string> _autoValidateIgnoredHttpMethods;
private HashSet<string> _autoValidateIgnoredHttpMethods = default!;
public AbpAntiForgeryOptions()
{

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AntiForgery/AspNetCoreAbpAntiForgeryManager.cs

@ -9,7 +9,7 @@ public class AspNetCoreAbpAntiForgeryManager : IAbpAntiForgeryManager, ITransien
{
protected AbpAntiForgeryOptions Options { get; }
protected HttpContext HttpContext => _httpContextAccessor.HttpContext;
protected HttpContext HttpContext => _httpContextAccessor.HttpContext!;
private readonly IAntiforgery _antiforgery;
private readonly IHttpContextAccessor _httpContextAccessor;
@ -27,7 +27,7 @@ public class AspNetCoreAbpAntiForgeryManager : IAbpAntiForgeryManager, ITransien
public virtual void SetCookie()
{
HttpContext.Response.Cookies.Append(
Options.TokenCookie.Name,
Options.TokenCookie.Name!,
GenerateToken(),
Options.TokenCookie.Build(HttpContext)
);
@ -35,6 +35,6 @@ public class AspNetCoreAbpAntiForgeryManager : IAbpAntiForgeryManager, ITransien
public virtual string GenerateToken()
{
return _antiforgery.GetAndStoreTokens(_httpContextAccessor.HttpContext).RequestToken;
return _antiforgery.GetAndStoreTokens(_httpContextAccessor.HttpContext!).RequestToken!;
}
}

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs

@ -62,11 +62,11 @@ public class AbpRemoteServiceApiDescriptionProvider : IApiDescriptionProvider, I
{
foreach (var apiResponse in _options.SupportedResponseTypes)
{
apiResponse.ModelMetadata = _modelMetadataProvider.GetMetadataForType(apiResponse.Type);
apiResponse.ModelMetadata = _modelMetadataProvider.GetMetadataForType(apiResponse.Type!);
foreach (var responseTypeMetadataProvider in _mvcOptions.OutputFormatters.OfType<IApiResponseTypeMetadataProvider>())
{
var formatterSupportedContentTypes = responseTypeMetadataProvider.GetSupportedContentTypes(null, apiResponse.Type);
var formatterSupportedContentTypes = responseTypeMetadataProvider.GetSupportedContentTypes(null!, apiResponse.Type!);
if (formatterSupportedContentTypes == null)
{
continue;

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs

@ -346,7 +346,7 @@ public class AbpApplicationConfigurationAppService : ApplicationService, IAbpApp
{
TimeZoneName = windowsTimeZoneId.IsNullOrWhiteSpace()
? null
: _timezoneProvider.WindowsToIana(windowsTimeZoneId)
: _timezoneProvider.WindowsToIana(windowsTimeZoneId!)
}
}
};

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationLocalizationAppService.cs

@ -50,7 +50,7 @@ public class AbpApplicationLocalizationAppService :
var localizer = await StringLocalizerFactory.CreateByResourceNameOrNullAsync(resource.ResourceName);
if (localizer != null)
{
Dictionary<string, LocalizedString> staticLocalizedStrings = null;
Dictionary<string, LocalizedString>? staticLocalizedStrings = null;
if (input.OnlyDynamics)
{
@ -71,7 +71,7 @@ public class AbpApplicationLocalizationAppService :
{
if (input.OnlyDynamics)
{
var staticLocalizedString = staticLocalizedStrings.GetOrDefault(localizedString.Name);
var staticLocalizedString = staticLocalizedStrings!.GetOrDefault(localizedString.Name);
if (staticLocalizedString != null &&
localizedString.Value == staticLocalizedString.Value)
{

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending;
public class CachedObjectExtensionsDtoService : ICachedObjectExtensionsDtoService, ISingletonDependency
{
protected IExtensionPropertyAttributeDtoFactory ExtensionPropertyAttributeDtoFactory { get; }
protected volatile ObjectExtensionsDto CachedValue;
protected volatile ObjectExtensionsDto? CachedValue;
protected readonly object SyncLock = new object();
public CachedObjectExtensionsDtoService(IExtensionPropertyAttributeDtoFactory extensionPropertyAttributeDtoFactory)
@ -193,7 +193,7 @@ public class CachedObjectExtensionsDtoService : ICachedObjectExtensionsDtoServic
return TypeHelper.GetSimplifiedName(propertyConfig.Type);
}
protected virtual LocalizableStringDto CreateDisplayNameDto(ExtensionPropertyConfiguration propertyConfig)
protected virtual LocalizableStringDto? CreateDisplayNameDto(ExtensionPropertyConfiguration propertyConfig)
{
if (propertyConfig.DisplayName == null)
{

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ExtensionPropertyAttributeDtoFactory.cs

@ -71,7 +71,7 @@ public class ExtensionPropertyAttributeDtoFactory : IExtensionPropertyAttributeD
return false;
}
protected virtual object GetPropertyValue(Attribute attribute, PropertyInfo property)
protected virtual object? GetPropertyValue(Attribute attribute, PropertyInfo property)
{
var value = property.GetValue(attribute);
if (value == null)

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationPartSorter.cs

@ -135,7 +135,7 @@ public static class ApplicationPartSorter
.ToArray();
}
private static CompiledRazorAssemblyPart GetViewsPartOrNull(ApplicationPartManager partManager,
private static CompiledRazorAssemblyPart? GetViewsPartOrNull(ApplicationPartManager partManager,
ApplicationPart assemblyPart)
{
var viewsAssemblyName = assemblyPart.Name + ".Views";
@ -145,7 +145,7 @@ public static class ApplicationPartSorter
.FirstOrDefault(p => p.Name == viewsAssemblyName);
}
private static AssemblyPart GetOriginalAssemblyPartOrNull(
private static AssemblyPart? GetOriginalAssemblyPartOrNull(
CompiledRazorAssemblyPart compiledRazorAssemblyPart,
ApplicationPartManager partManager)
{
@ -155,7 +155,7 @@ public static class ApplicationPartSorter
.FirstOrDefault(p => p.Name == originalAssemblyName);
}
private static IAbpModuleDescriptor GetModuleDescriptorForAssemblyOrNull(
private static IAbpModuleDescriptor? GetModuleDescriptorForAssemblyOrNull(
IModuleContainer moduleContainer,
Assembly assembly)
{

19
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs

@ -162,7 +162,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
}
private static List<string> GetSupportedVersions(Type controllerType, MethodInfo method,
ConventionalControllerSetting setting)
ConventionalControllerSetting? setting)
{
var supportedVersions = new List<ApiVersion>();
@ -196,7 +196,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
}
private static void AddCustomTypesToModel(ApplicationApiDescriptionModel applicationModel,
[CanBeNull] Type type)
Type? type)
{
if (type == null)
{
@ -275,7 +275,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
.Select(_ => "T" + i++)
.JoinAsString(",");
return $"{type.FullName.Left(type.FullName.IndexOf('`'))}<{argumentList}>";
return $"{type.FullName!.Left(type.FullName!.IndexOf('`'))}<{argumentList}>";
}
private void AddParameterDescriptionsToModel(ActionApiDescriptionModel actionModel, MethodInfo method,
@ -339,16 +339,16 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
if (modelNameProvider == null)
{
return parameterInfo.Name;
return parameterInfo.Name!;
}
return modelNameProvider.Name ?? parameterInfo.Name;
return (modelNameProvider.Name ?? parameterInfo.Name)!;
}
private static string GetRootPath(
[NotNull] Type controllerType,
[NotNull] ActionDescriptor actionDescriptor,
[CanBeNull] ConventionalControllerSetting setting)
ConventionalControllerSetting? setting)
{
if (setting != null)
{
@ -364,7 +364,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
return ModuleApiDescriptionModel.DefaultRootPath;
}
private string GetRemoteServiceName(Type controllerType, [CanBeNull] ConventionalControllerSetting setting)
private string GetRemoteServiceName(Type controllerType, ConventionalControllerSetting? setting)
{
if (setting != null)
{
@ -381,7 +381,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
return ModuleApiDescriptionModel.DefaultRemoteServiceName;
}
private string FindGroupName(Type controllerType)
private string? FindGroupName(Type controllerType)
{
var controllerNameAttribute =
controllerType.GetCustomAttributes().OfType<ControllerNameAttribute>().FirstOrDefault();
@ -394,8 +394,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
return null;
}
[CanBeNull]
private ConventionalControllerSetting FindSetting(Type controllerType)
private ConventionalControllerSetting? FindSetting(Type controllerType)
{
foreach (var controllerSetting in _abpAspNetCoreMvcOptions.ConventionalControllers.ConventionalControllerSettings)
{

8
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProviderOptions.cs

@ -12,11 +12,11 @@ namespace Volo.Abp.AspNetCore.Mvc;
public class AspNetCoreApiDescriptionModelProviderOptions
{
public Func<Type, ConventionalControllerSetting, string> ControllerNameGenerator { get; set; }
public Func<Type, ConventionalControllerSetting?, string> ControllerNameGenerator { get; set; }
public Func<MethodInfo, string> ActionNameGenerator { get; set; }
public Func<ApiParameterDescription, string> ApiParameterNameGenerator { get; set; }
public Func<ApiParameterDescription, string?> ApiParameterNameGenerator { get; set; }
public AspNetCoreApiDescriptionModelProviderOptions()
{
@ -51,7 +51,7 @@ public class AspNetCoreApiDescriptionModelProviderOptions
methodNameBuilder.Append("And");
}
methodNameBuilder.Append(parameters[i].Name.ToPascalCase());
methodNameBuilder.Append(parameters[i].Name!.ToPascalCase());
}
}
@ -62,7 +62,7 @@ public class AspNetCoreApiDescriptionModelProviderOptions
{
if (apiParameterDescription.ModelMetadata is DefaultModelMetadata defaultModelMetadata)
{
var jsonPropertyNameAttribute = (JsonPropertyNameAttribute)
var jsonPropertyNameAttribute = (JsonPropertyNameAttribute?)
defaultModelMetadata?.Attributes?.PropertyAttributes?.FirstOrDefault(x => x is JsonPropertyNameAttribute);
if (jsonPropertyNameAttribute != null)
{

8
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs

@ -30,12 +30,12 @@ public class AbpAuditActionFilter : IAsyncActionFilter, ITransientDependency
if (result.Exception != null && !result.ExceptionHandled)
{
auditLog.Exceptions.Add(result.Exception);
auditLog!.Exceptions.Add(result.Exception);
}
}
catch (Exception ex)
{
auditLog.Exceptions.Add(ex);
auditLog!.Exceptions.Add(ex);
throw;
}
finally
@ -45,13 +45,13 @@ public class AbpAuditActionFilter : IAsyncActionFilter, ITransientDependency
if (auditLogAction != null)
{
auditLogAction.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
auditLog.Actions.Add(auditLogAction);
auditLog!.Actions.Add(auditLogAction);
}
}
}
}
private bool ShouldSaveAudit(ActionExecutingContext context, out AuditLogInfo auditLog, out AuditLogActionInfo auditLogAction)
private bool ShouldSaveAudit(ActionExecutingContext context, out AuditLogInfo? auditLog, out AuditLogActionInfo? auditLogAction)
{
auditLog = null;
auditLogAction = null;

10
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditPageFilter.cs

@ -35,12 +35,12 @@ public class AbpAuditPageFilter : IAsyncPageFilter, ITransientDependency
if (result.Exception != null && !result.ExceptionHandled)
{
auditLog.Exceptions.Add(result.Exception);
auditLog!.Exceptions.Add(result.Exception);
}
}
catch (Exception ex)
{
auditLog.Exceptions.Add(ex);
auditLog!.Exceptions.Add(ex);
throw;
}
finally
@ -50,13 +50,13 @@ public class AbpAuditPageFilter : IAsyncPageFilter, ITransientDependency
if (auditLogAction != null)
{
auditLogAction.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
auditLog.Actions.Add(auditLogAction);
auditLog!.Actions.Add(auditLogAction);
}
}
}
}
private bool ShouldSaveAudit(PageHandlerExecutingContext context, out AuditLogInfo auditLog, out AuditLogActionInfo auditLogAction)
private bool ShouldSaveAudit(PageHandlerExecutingContext context, out AuditLogInfo? auditLog, out AuditLogActionInfo? auditLogAction)
{
auditLog = null;
auditLogAction = null;
@ -79,7 +79,7 @@ public class AbpAuditPageFilter : IAsyncPageFilter, ITransientDependency
}
var auditingHelper = context.GetRequiredService<IAuditingHelper>();
if (!auditingHelper.ShouldSaveAudit(context.HandlerMethod.MethodInfo, defaultValue: true))
if (!auditingHelper.ShouldSaveAudit(context.HandlerMethod!.MethodInfo, defaultValue: true))
{
return false;
}

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs

@ -14,7 +14,7 @@ public abstract class ChallengeAccountController : AbpController
protected string AuthenticationType { get; }
protected string[] ForbidSchemes { get; }
protected ChallengeAccountController(string[] challengeAuthenticationSchemas = null)
protected ChallengeAccountController(string[]? challengeAuthenticationSchemas = null)
{
ChallengeAuthenticationSchemas = challengeAuthenticationSchemas ?? new[] { "oidc" };
AuthenticationType = "Identity.Application";
@ -68,12 +68,12 @@ public abstract class ChallengeAccountController : AbpController
{
RedirectUri = GetRedirectUrl(returnUrl, returnUrlHash)
},
ForbidSchemes.IsNullOrEmpty()
(ForbidSchemes.IsNullOrEmpty()
? new[]
{
HttpContext.RequestServices.GetRequiredService<IOptions<AuthenticationOptions>>().Value.DefaultForbidScheme
}
: ForbidSchemes
: ForbidSchemes)!
));
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/AbpRemoteStreamContentModelBinder.cs

@ -155,6 +155,6 @@ public class AbpRemoteStreamContentModelBinder<TRemoteStreamContent> : IModelBin
return new List<T>();
}
return (ICollection<T>)Activator.CreateInstance(modelType);
return (ICollection<T>)Activator.CreateInstance(modelType)!;
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/AbpRemoteStreamContentModelBinderProvider.cs

@ -7,7 +7,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ContentFormatters;
public class AbpRemoteStreamContentModelBinderProvider : IModelBinderProvider
{
public IModelBinder GetBinder(ModelBinderProviderContext context)
public IModelBinder? GetBinder(ModelBinderProviderContext context)
{
if (context == null)
{

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs

@ -13,14 +13,14 @@ public class RemoteStreamContentOutputFormatter : OutputFormatter
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("*/*"));
}
protected override bool CanWriteType(Type type)
protected override bool CanWriteType(Type? type)
{
return typeof(IRemoteStreamContent).IsAssignableFrom(type);
}
public async override Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
{
var remoteStream = (IRemoteStreamContent)context.Object;
var remoteStream = (IRemoteStreamContent?)context.Object;
if (remoteStream != null)
{

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpConventionalControllerOptions.cs

@ -33,7 +33,7 @@ public class AbpConventionalControllerOptions
public AbpConventionalControllerOptions Create(
Assembly assembly,
[CanBeNull] Action<ConventionalControllerSetting> optionsAction = null)
Action<ConventionalControllerSetting>? optionsAction = null)
{
var setting = new ConventionalControllerSetting(
assembly,

27
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs

@ -105,7 +105,7 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
if (removeControllerModels.Any())
{
controllerModelsToRemove.AddRange(removeControllerModels);
Logger.LogInformation($"Removing the controller{(removeControllerModels.Length > 1 ? "s" : "")} {removeControllerModels.Select(c => c.ControllerType.AssemblyQualifiedName).JoinAsString(", ")} from the application model");
Logger.LogInformation($"Removing the controller{(removeControllerModels.Length > 1 ? "s" : "")} {removeControllerModels.Select(c => c.ControllerType.AssemblyQualifiedName)!.JoinAsString(", ")} from the application model");
}
}
@ -121,7 +121,7 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
if (replaceControllerModels.Any())
{
controllerModelsToRemove.AddRange(replaceControllerModels);
Logger.LogInformation($"Removing the controller{(replaceControllerModels.Length > 1 ? "s" : "")} {replaceControllersAttr.ControllerTypes.Select(c => c.AssemblyQualifiedName).JoinAsString(", ")} from the application model since {(replaceControllerModels.Length > 1 ? "they are" : "it is")} replaced by the controller: {controllerModel.ControllerType.AssemblyQualifiedName}");
Logger.LogInformation($"Removing the controller{(replaceControllerModels.Length > 1 ? "s" : "")} {replaceControllersAttr.ControllerTypes.Select(c => c.AssemblyQualifiedName)!.JoinAsString(", ")} from the application model since {(replaceControllerModels.Length > 1 ? "they are" : "it is")} replaced by the controller: {controllerModel.ControllerType.AssemblyQualifiedName}");
}
}
}
@ -139,7 +139,7 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
}
var exposeServicesAttr = ReflectionHelper.GetSingleAttributeOrDefault<ExposeServicesAttribute>(controllerModel.ControllerType);
if (exposeServicesAttr.IncludeSelf)
if (exposeServicesAttr!.IncludeSelf)
{
var exposedControllerModels = GetControllers(application)
.Where(cm => exposeServicesAttr.ServiceTypes.Contains(cm.ControllerType))
@ -148,7 +148,7 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
if (exposedControllerModels.Any())
{
controllerModelsToRemove.AddRange(exposedControllerModels);
Logger.LogInformation($"Removing the controller{(exposedControllerModels.Length > 1 ? "s" : "")} {exposeServicesAttr.ServiceTypes.Select(c => c.AssemblyQualifiedName).JoinAsString(", ")} from the application model since {(exposedControllerModels.Length > 1 ? "they are" : "it is")} replaced by the controller: {controllerModel.ControllerType.AssemblyQualifiedName}");
Logger.LogInformation($"Removing the controller{(exposedControllerModels.Length > 1 ? "s" : "")} {exposeServicesAttr.ServiceTypes.Select(c => c.AssemblyQualifiedName)!.JoinAsString(", ")} from the application model since {(exposedControllerModels.Length > 1 ? "they are" : "it is")} replaced by the controller: {controllerModel.ControllerType.AssemblyQualifiedName}");
}
continue;
}
@ -173,13 +173,13 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
}
controllerModelsToRemove.Add(controllerModel);
Logger.LogInformation($"Removing the controller {controllerModel.ControllerType.AssemblyQualifiedName} from the application model since it replaces the controller(s): {baseControllerTypes.Select(c => c.AssemblyQualifiedName).JoinAsString(", ")}");
Logger.LogInformation($"Removing the controller {controllerModel.ControllerType.AssemblyQualifiedName} from the application model since it replaces the controller(s): {baseControllerTypes.Select(c => c.AssemblyQualifiedName)!.JoinAsString(", ")}");
}
application.Controllers.RemoveAll(controllerModelsToRemove);
}
protected virtual void ConfigureRemoteService(ControllerModel controller, [CanBeNull] ConventionalControllerSetting configuration)
protected virtual void ConfigureRemoteService(ControllerModel controller, ConventionalControllerSetting? configuration)
{
ConfigureApiExplorer(controller);
ConfigureSelector(controller, configuration);
@ -288,7 +288,7 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
action.ApiExplorer.IsVisible = visible;
}
protected virtual void ConfigureSelector(ControllerModel controller, [CanBeNull] ConventionalControllerSetting configuration)
protected virtual void ConfigureSelector(ControllerModel controller, ConventionalControllerSetting? configuration)
{
RemoveEmptySelectors(controller.Selectors);
@ -312,7 +312,7 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
}
}
protected virtual void ConfigureSelector(string rootPath, string controllerName, ActionModel action, [CanBeNull] ConventionalControllerSetting configuration)
protected virtual void ConfigureSelector(string rootPath, string controllerName, ActionModel action, ConventionalControllerSetting? configuration)
{
RemoveEmptySelectors(action.Selectors);
@ -332,7 +332,7 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
}
}
protected virtual void AddAbpServiceSelector(string rootPath, string controllerName, ActionModel action, [CanBeNull] ConventionalControllerSetting configuration)
protected virtual void AddAbpServiceSelector(string rootPath, string controllerName, ActionModel action, ConventionalControllerSetting? configuration)
{
var httpMethod = SelectHttpMethod(action, configuration);
@ -345,12 +345,12 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
action.Selectors.Add(abpServiceSelectorModel);
}
protected virtual string SelectHttpMethod(ActionModel action, ConventionalControllerSetting configuration)
protected virtual string SelectHttpMethod(ActionModel action, ConventionalControllerSetting? configuration)
{
return HttpMethodHelper.GetConventionalVerbForMethodName(action.ActionName);
}
protected virtual void NormalizeSelectorRoutes(string rootPath, string controllerName, ActionModel action, [CanBeNull] ConventionalControllerSetting configuration)
protected virtual void NormalizeSelectorRoutes(string rootPath, string controllerName, ActionModel action, ConventionalControllerSetting? configuration)
{
foreach (var selector in action.Selectors)
{
@ -394,13 +394,12 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency
return ModuleApiDescriptionModel.DefaultRootPath;
}
[CanBeNull]
protected virtual ConventionalControllerSetting GetControllerSettingOrNull(Type controllerType)
protected virtual ConventionalControllerSetting? GetControllerSettingOrNull(Type controllerType)
{
return Options.ConventionalControllers.ConventionalControllerSettings.GetSettingOrNull(controllerType);
}
protected virtual AttributeRouteModel CreateAbpServiceAttributeRouteModel(string rootPath, string controllerName, ActionModel action, string httpMethod, [CanBeNull] ConventionalControllerSetting configuration)
protected virtual AttributeRouteModel CreateAbpServiceAttributeRouteModel(string rootPath, string controllerName, ActionModel action, string httpMethod, ConventionalControllerSetting? configuration)
{
return new AttributeRouteModel(
new RouteAttribute(

20
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSetting.cs

@ -33,7 +33,7 @@ public class ConventionalControllerSetting
_rootPath = value;
}
}
private string _rootPath;
private string _rootPath = default!;
[NotNull]
public string RemoteServiceName {
@ -43,28 +43,24 @@ public class ConventionalControllerSetting
_remoteServiceName = value;
}
}
private string _remoteServiceName;
private string _remoteServiceName = default!;
[CanBeNull]
public Func<Type, bool> TypePredicate { get; set; }
public Func<Type, bool>? TypePredicate { get; set; }
/// <summary>
/// Default value: All.
/// </summary>
public ApplicationServiceTypes ApplicationServiceTypes { get; set; } = ApplicationServiceTypes.All;
[CanBeNull]
public Action<ControllerModel> ControllerModelConfigurer { get; set; }
public Action<ControllerModel>? ControllerModelConfigurer { get; set; }
[CanBeNull]
public Func<UrlControllerNameNormalizerContext, string> UrlControllerNameNormalizer { get; set; }
public Func<UrlControllerNameNormalizerContext, string>? UrlControllerNameNormalizer { get; set; }
[CanBeNull]
public Func<UrlActionNameNormalizerContext, string> UrlActionNameNormalizer { get; set; }
public Func<UrlActionNameNormalizerContext, string>? UrlActionNameNormalizer { get; set; }
public List<ApiVersion> ApiVersions { get; }
public Action<ApiVersioningOptions> ApiVersionConfigurer { get; set; }
public Action<ApiVersioningOptions>? ApiVersionConfigurer { get; set; }
public ConventionalControllerSetting(
[NotNull] Assembly assembly,
@ -84,7 +80,7 @@ public class ConventionalControllerSetting
var types = Assembly.GetTypes()
.Where(IsRemoteService)
.Where(IsPreferredApplicationServiceType)
.WhereIf(TypePredicate != null, TypePredicate);
.WhereIf(TypePredicate != null, TypePredicate!);
foreach (var type in types)
{

3
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalControllerSettingList.cs

@ -7,8 +7,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions;
public class ConventionalControllerSettingList : List<ConventionalControllerSetting>
{
[CanBeNull]
public ConventionalControllerSetting GetSettingOrNull(Type controllerType)
public ConventionalControllerSetting? GetSettingOrNull(Type controllerType)
{
return this.FirstOrDefault(controllerSetting => controllerSetting.ControllerTypes.Contains(controllerType));
}

16
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/ConventionalRouteBuilder.cs

@ -24,7 +24,7 @@ public class ConventionalRouteBuilder : IConventionalRouteBuilder, ITransientDep
string controllerName,
ActionModel action,
string httpMethod,
[CanBeNull] ConventionalControllerSetting configuration)
ConventionalControllerSetting? configuration)
{
var apiRoutePrefix = GetApiRoutePrefix(action, configuration);
var controllerNameInUrl =
@ -71,7 +71,7 @@ public class ConventionalRouteBuilder : IConventionalRouteBuilder, ITransientDep
return url;
}
protected virtual string GetApiRoutePrefix(ActionModel actionModel, ConventionalControllerSetting configuration)
protected virtual string GetApiRoutePrefix(ActionModel actionModel, ConventionalControllerSetting? configuration)
{
if (IntegrationServiceAttribute.IsDefinedOrInherited(actionModel.Controller.ControllerType))
{
@ -82,7 +82,7 @@ public class ConventionalRouteBuilder : IConventionalRouteBuilder, ITransientDep
}
protected virtual string NormalizeUrlActionName(string rootPath, string controllerName, ActionModel action,
string httpMethod, [CanBeNull] ConventionalControllerSetting configuration)
string httpMethod, ConventionalControllerSetting? configuration)
{
var actionNameInUrl = HttpMethodHelper
.RemoveHttpMethodPrefix(action.ActionName, httpMethod)
@ -105,7 +105,7 @@ public class ConventionalRouteBuilder : IConventionalRouteBuilder, ITransientDep
}
protected virtual string NormalizeUrlControllerName(string rootPath, string controllerName, ActionModel action,
string httpMethod, [CanBeNull] ConventionalControllerSetting configuration)
string httpMethod, ConventionalControllerSetting? configuration)
{
if (configuration?.UrlControllerNameNormalizer == null)
{
@ -121,7 +121,7 @@ public class ConventionalRouteBuilder : IConventionalRouteBuilder, ITransientDep
}
protected virtual string NormalizeControllerNameCase(string controllerName,
[CanBeNull] ConventionalControllerSetting configuration)
ConventionalControllerSetting? configuration)
{
if (configuration?.UseV3UrlStyle ?? Options.UseV3UrlStyle)
{
@ -134,7 +134,7 @@ public class ConventionalRouteBuilder : IConventionalRouteBuilder, ITransientDep
}
protected virtual string NormalizeActionNameCase(string actionName,
[CanBeNull] ConventionalControllerSetting configuration)
ConventionalControllerSetting? configuration)
{
if (configuration?.UseV3UrlStyle ?? Options.UseV3UrlStyle)
{
@ -147,13 +147,13 @@ public class ConventionalRouteBuilder : IConventionalRouteBuilder, ITransientDep
}
protected virtual string NormalizeIdPropertyNameCase(PropertyInfo property,
[CanBeNull] ConventionalControllerSetting configuration)
ConventionalControllerSetting? configuration)
{
return property.Name;
}
protected virtual string NormalizeSecondaryIdNameCase(ParameterModel secondaryId,
[CanBeNull] ConventionalControllerSetting configuration)
ConventionalControllerSetting? configuration)
{
return secondaryId.ParameterName;
}

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/IConventionalRouteBuilder.cs

@ -10,6 +10,6 @@ public interface IConventionalRouteBuilder
string controllerName,
ActionModel action,
string httpMethod,
[CanBeNull] ConventionalControllerSetting configuration
ConventionalControllerSetting? configuration
);
}

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DataAnnotations/AbpValidationAttributeAdapterProvider.cs

@ -14,7 +14,7 @@ public class AbpValidationAttributeAdapterProvider : IValidationAttributeAdapter
_defaultAdapter = defaultAdapter;
}
public virtual IAttributeAdapter GetAttributeAdapter(ValidationAttribute attribute, IStringLocalizer stringLocalizer)
public virtual IAttributeAdapter? GetAttributeAdapter(ValidationAttribute attribute, IStringLocalizer? stringLocalizer)
{
var type = attribute.GetType();

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DataAnnotations/DynamicMaxLengthAttributeAdapter.cs

@ -12,7 +12,7 @@ public class DynamicMaxLengthAttributeAdapter : AttributeAdapterBase<DynamicMaxL
public DynamicMaxLengthAttributeAdapter(
DynamicMaxLengthAttribute attribute,
IStringLocalizer stringLocalizer)
IStringLocalizer? stringLocalizer)
: base(attribute, stringLocalizer)
{
_max = Attribute.Length.ToString(CultureInfo.InvariantCulture);

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DataAnnotations/DynamicRangeAttributeAdapter.cs

@ -14,11 +14,11 @@ public class DynamicRangeAttributeAdapter : AttributeAdapterBase<DynamicRangeAtt
public DynamicRangeAttributeAdapter(
DynamicRangeAttribute attribute,
IStringLocalizer stringLocalizer)
IStringLocalizer? stringLocalizer)
: base(attribute, stringLocalizer)
{
_min = Convert.ToString(Attribute.Minimum, CultureInfo.InvariantCulture);
_max = Convert.ToString(Attribute.Maximum, CultureInfo.InvariantCulture);
_min = Convert.ToString(Attribute.Minimum, CultureInfo.InvariantCulture)!;
_max = Convert.ToString(Attribute.Maximum, CultureInfo.InvariantCulture)!;
}
public override void AddValidation(ClientModelValidationContext context)

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DataAnnotations/DynamicStringLengthAttributeAdapter.cs

@ -14,7 +14,7 @@ public class DynamicStringLengthAttributeAdapter : AttributeAdapterBase<DynamicS
public DynamicStringLengthAttributeAdapter(
DynamicStringLengthAttribute attribute,
IStringLocalizer stringLocalizer)
IStringLocalizer? stringLocalizer)
: base(attribute, stringLocalizer)
{
_max = Attribute.MaximumLength.ToString(CultureInfo.InvariantCulture);

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs

@ -77,7 +77,7 @@ public class AbpExceptionFilter : IAsyncExceptionFilter, ITransientDependency
context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo));
}
context.Exception = null; //Handled!
context.Exception = null!; //Handled!
}
protected virtual void LogException(ExceptionContext context, out RemoteServiceErrorInfo remoteServiceErrorInfo)
@ -94,7 +94,7 @@ public class AbpExceptionFilter : IAsyncExceptionFilter, ITransientDependency
remoteServiceErrorInfoBuilder.AppendLine($"---------- {nameof(RemoteServiceErrorInfo)} ----------");
remoteServiceErrorInfoBuilder.AppendLine(context.GetRequiredService<IJsonSerializer>().Serialize(remoteServiceErrorInfo, indented: true));
var logger = context.GetService<ILogger<AbpExceptionFilter>>(NullLogger<AbpExceptionFilter>.Instance);
var logger = context.GetService<ILogger<AbpExceptionFilter>>(NullLogger<AbpExceptionFilter>.Instance)!;
var logLevel = context.Exception.GetLogLevel();
logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString());
logger.LogException(context.Exception, logLevel);

14
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs

@ -47,7 +47,7 @@ public class AbpExceptionPageFilter : IAsyncPageFilter, ITransientDependency
//TODO: Create DontWrap attribute to control wrapping..?
if (context.ActionDescriptor.IsPageAction() &&
ActionResultHelper.IsObjectResult(context.HandlerMethod.MethodInfo.ReturnType, typeof(void)))
ActionResultHelper.IsObjectResult(context.HandlerMethod!.MethodInfo.ReturnType, typeof(void)))
{
return true;
}
@ -71,24 +71,24 @@ public class AbpExceptionPageFilter : IAsyncPageFilter, ITransientDependency
var exceptionHandlingOptions = context.GetRequiredService<IOptions<AbpExceptionHandlingOptions>>().Value;
var exceptionToErrorInfoConverter = context.GetRequiredService<IExceptionToErrorInfoConverter>();
var remoteServiceErrorInfo = exceptionToErrorInfoConverter.Convert(context.Exception, options =>
var remoteServiceErrorInfo = exceptionToErrorInfoConverter.Convert(context.Exception!, options =>
{
options.SendExceptionsDetailsToClients = exceptionHandlingOptions.SendExceptionsDetailsToClients;
options.SendStackTraceToClients = exceptionHandlingOptions.SendStackTraceToClients;
});
var logLevel = context.Exception.GetLogLevel();
var logLevel = context.Exception!.GetLogLevel();
var remoteServiceErrorInfoBuilder = new StringBuilder();
remoteServiceErrorInfoBuilder.AppendLine($"---------- {nameof(RemoteServiceErrorInfo)} ----------");
remoteServiceErrorInfoBuilder.AppendLine(context.GetRequiredService<IJsonSerializer>().Serialize(remoteServiceErrorInfo, indented: true));
var logger = context.GetService<ILogger<AbpExceptionFilter>>(NullLogger<AbpExceptionFilter>.Instance);
var logger = context.GetService<ILogger<AbpExceptionFilter>>(NullLogger<AbpExceptionFilter>.Instance)!;
logger.LogWithLevel(logLevel, remoteServiceErrorInfoBuilder.ToString());
logger.LogException(context.Exception, logLevel);
logger.LogException(context.Exception!, logLevel);
await context.GetRequiredService<IExceptionNotifier>().NotifyAsync(new ExceptionNotificationContext(context.Exception));
await context.GetRequiredService<IExceptionNotifier>().NotifyAsync(new ExceptionNotificationContext(context.Exception!));
if (context.Exception is AbpAuthorizationException)
{
@ -100,7 +100,7 @@ public class AbpExceptionPageFilter : IAsyncPageFilter, ITransientDependency
context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true");
context.HttpContext.Response.StatusCode = (int)context
.GetRequiredService<IHttpExceptionStatusCodeFinder>()
.GetStatusCode(context.HttpContext, context.Exception);
.GetStatusCode(context.HttpContext, context.Exception!);
context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo));
}

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeatureActionFilter.cs

@ -23,7 +23,7 @@ public class GlobalFeatureActionFilter : IAsyncActionFilter, ITransientDependenc
if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(context.Controller.GetType(), out var attribute))
{
var logger = context.GetService<ILogger<GlobalFeatureActionFilter>>(NullLogger<GlobalFeatureActionFilter>.Instance);
var logger = context.GetService<ILogger<GlobalFeatureActionFilter>>(NullLogger<GlobalFeatureActionFilter>.Instance)!;
logger.LogWarning($"The '{context.Controller.GetType().FullName}' controller needs to enable '{attribute.Name}' feature.");
context.Result = new NotFoundResult();
return;

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/GlobalFeatures/GlobalFeaturePageFilter.cs

@ -28,7 +28,7 @@ public class GlobalFeaturePageFilter : IAsyncPageFilter, ITransientDependency
if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(context.HandlerInstance.GetType(), out var attribute))
{
var logger = context.GetService<ILogger<GlobalFeatureActionFilter>>(NullLogger<GlobalFeatureActionFilter>.Instance);
var logger = context.GetService<ILogger<GlobalFeatureActionFilter>>(NullLogger<GlobalFeatureActionFilter>.Instance)!;
logger.LogWarning($"The '{context.HandlerInstance.GetType().FullName}' page needs to enable '{attribute.Name}' feature.");
context.Result = new NotFoundResult();
return;

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpMvcAttributeValidationResultProvider.cs

@ -22,7 +22,7 @@ public class AbpMvcAttributeValidationResultProvider : DefaultAttributeValidatio
_stringLocalizerFactory = stringLocalizerFactory;
}
public override ValidationResult GetOrDefault(ValidationAttribute validationAttribute, object validatingObject, ValidationContext validationContext)
public override ValidationResult? GetOrDefault(ValidationAttribute validationAttribute, object? validatingObject, ValidationContext validationContext)
{
var resourceSource = _abpMvcDataAnnotationsLocalizationOptions.AssemblyResources.GetOrDefault(validationContext.ObjectType.Assembly);
if (resourceSource == null)

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinderProvider.cs

@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding;
public class AbpDateTimeModelBinderProvider : IModelBinderProvider
{
public IModelBinder GetBinder(ModelBinderProviderContext context)
public IModelBinder? GetBinder(ModelBinderProviderContext context)
{
var modelType = context.Metadata.UnderlyingOrModelType;
if (modelType == typeof(DateTime))
@ -31,7 +31,7 @@ public class AbpDateTimeModelBinderProvider : IModelBinderProvider
context.Metadata.ContainerType.IsDefined(typeof(DisableDateTimeNormalizationAttribute), true);
var dateNormalizationDisabledForProperty = context.Metadata.ContainerType
.GetProperty(context.Metadata.PropertyName)
.GetProperty(context.Metadata.PropertyName!)
?.IsDefined(typeof(DisableDateTimeNormalizationAttribute), true);
if (!dateNormalizationDisabledForClass &&

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpExtraPropertiesDictionaryModelBinderProvider.cs

@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding;
public class AbpExtraPropertiesDictionaryModelBinderProvider : IModelBinderProvider
{
public IModelBinder GetBinder(ModelBinderProviderContext context)
public IModelBinder? GetBinder(ModelBinderProviderContext context)
{
if (context == null)
{
@ -41,6 +41,6 @@ public class AbpExtraPropertiesDictionaryModelBinderProvider : IModelBinderProvi
valueBinder,
loggerFactory,
true /* allowValidatingTopLevelNodes */,
mvcOptions);
mvcOptions)!;
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpExtraPropertyModelBinder.cs

@ -35,7 +35,7 @@ public class AbpExtraPropertyModelBinder : IModelBinder
return Task.CompletedTask;
}
protected virtual object ConvertStringToPropertyType(ModelBindingContext bindingContext, string value)
protected virtual object? ConvertStringToPropertyType(ModelBindingContext bindingContext, string? value)
{
if (bindingContext.ModelMetadata.ConvertEmptyStringToNull && string.IsNullOrWhiteSpace(value))
{

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/ExtraPropertyBindingHelper.cs

@ -8,7 +8,7 @@ public static class ExtraPropertyBindingHelper
/// <paramref name="expression"/> is a string like "UserInfo.ExtraProperties[SocialSecurityNumber]"
/// This method returns "SocialSecurityNumber" for this example. */
/// </summary>
public static string ExtractExtraPropertyName(string expression)
public static string? ExtractExtraPropertyName(string expression)
{
var index = expression.IndexOf("ExtraProperties[", StringComparison.Ordinal);
if (index < 0)
@ -23,7 +23,7 @@ public static class ExtraPropertyBindingHelper
/// <paramref name="expression"/> is a string like "UserInfo.ExtraProperties[SocialSecurityNumber]"
/// This method returns "UserInfo" for this example.
/// </summary>
public static string ExtractContainerName(string expression)
public static string? ExtractContainerName(string expression)
{
var index = expression.IndexOf("ExtraProperties[", StringComparison.Ordinal);
if (index < 0)

14
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs

@ -7,15 +7,15 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting;
public class ServiceProxyGenerationModel
{
public string Type { get; set; }
public string? Type { get; set; }
public bool UseCache { get; set; }
public string Modules { get; set; }
public string? Modules { get; set; }
public string Controllers { get; set; }
public string? Controllers { get; set; }
public string Actions { get; set; }
public string? Actions { get; set; }
public ServiceProxyGenerationModel()
{
@ -36,17 +36,17 @@ public class ServiceProxyGenerationModel
if (!Modules.IsNullOrEmpty())
{
options.Modules = Modules.Split('|').Select(m => m.Trim()).ToArray();
options.Modules = Modules!.Split('|').Select(m => m.Trim()).ToArray();
}
if (!Controllers.IsNullOrEmpty())
{
options.Controllers = Controllers.Split('|').Select(m => m.Trim()).ToArray();
options.Controllers = Controllers!.Split('|').Select(m => m.Trim()).ToArray();
}
if (!Actions.IsNullOrEmpty())
{
options.Actions = Actions.Split('|').Select(m => m.Trim()).ToArray();
options.Actions = Actions!.Split('|').Select(m => m.Trim()).ToArray();
}
return options;

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs

@ -67,7 +67,7 @@ public class AbpUowActionFilter : IAsyncActionFilter, ITransientDependency
}
}
private AbpUnitOfWorkOptions CreateOptions(ActionExecutingContext context, UnitOfWorkAttribute unitOfWorkAttribute)
private AbpUnitOfWorkOptions CreateOptions(ActionExecutingContext context, UnitOfWorkAttribute? unitOfWorkAttribute)
{
var options = new AbpUnitOfWorkOptions();

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs

@ -73,7 +73,7 @@ public class AbpUowPageFilter : IAsyncPageFilter, ITransientDependency
}
}
private AbpUnitOfWorkOptions CreateOptions(PageHandlerExecutingContext context, UnitOfWorkAttribute unitOfWorkAttribute)
private AbpUnitOfWorkOptions CreateOptions(PageHandlerExecutingContext context, UnitOfWorkAttribute? unitOfWorkAttribute)
{
var options = new AbpUnitOfWorkOptions();

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Utils/ArrayMatcher.cs

@ -33,7 +33,7 @@ internal static class ArrayMatcher
}
var resultItem = EqualityComparer<T>.Default.Equals(parentItem, default) ? sourceItem : parentItem;
result.Add(resultItem);
result.Add(resultItem!);
}
return result.ToArray();

4
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/ValidationAttributeHelper.cs

@ -6,10 +6,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation;
public static class ValidationAttributeHelper
{
private static readonly PropertyInfo ValidationAttributeErrorMessageStringProperty = typeof(ValidationAttribute)
.GetProperty("ErrorMessageString", BindingFlags.Instance | BindingFlags.NonPublic);
.GetProperty("ErrorMessageString", BindingFlags.Instance | BindingFlags.NonPublic)!;
private static readonly PropertyInfo ValidationAttributeCustomErrorMessageSetProperty = typeof(ValidationAttribute)
.GetProperty("CustomErrorMessageSet", BindingFlags.Instance | BindingFlags.NonPublic);
.GetProperty("CustomErrorMessageSet", BindingFlags.Instance | BindingFlags.NonPublic)!;
public static void SetDefaultErrorMessage(ValidationAttribute validationAttribute)
{

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Versioning/HttpContextRequestedApiVersion.cs

@ -6,7 +6,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning;
public class HttpContextRequestedApiVersion : IRequestedApiVersion
{
public string Current => _httpContextAccessor.HttpContext?.GetRequestedApiVersion()?.ToString();
public string? Current => _httpContextAccessor.HttpContext?.GetRequestedApiVersion()?.ToString();
private readonly IHttpContextAccessor _httpContextAccessor;

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/ObjectExtending/ObjectExtensionPropertyInfoAspNetCoreMvcExtensions.cs

@ -34,7 +34,7 @@ public static class ObjectExtensionPropertyInfoAspNetCoreMvcExtensions
.FirstOrDefault()?.DataType;
}
public static string GetDataFormatStringOrNull(this IBasicObjectExtensionPropertyInfo property)
public static string? GetDataFormatStringOrNull(this IBasicObjectExtensionPropertyInfo property)
{
return property
.Attributes

Loading…
Cancel
Save