diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs index 9e3b0bfba2..f1d014b76a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs @@ -145,7 +145,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide ActionApiDescriptionModel.Create( uniqueMethodName, method, - apiDescription.RelativePath, + apiDescription.RelativePath!, apiDescription.HttpMethod, GetSupportedVersions(controllerType, method, setting), allowAnonymous, diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs index b912d3905a..d4fd27d889 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs @@ -32,7 +32,7 @@ public class ServiceProxyGenerationModel public ProxyScriptingModel CreateOptions() { - var options = new ProxyScriptingModel(Type, UseCache); + var options = new ProxyScriptingModel(Type!, UseCache); if (!Modules.IsNullOrEmpty()) { diff --git a/framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj b/framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj index 332c803147..adbc783c15 100644 --- a/framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj +++ b/framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Http.Abstractions Volo.Abp.Http.Abstractions $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Http.Abstractions/Volo/Abp/Http/ClientProxyExceptionEventData.cs b/framework/src/Volo.Abp.Http.Abstractions/Volo/Abp/Http/ClientProxyExceptionEventData.cs index 1bc17c7b65..029556c00e 100644 --- a/framework/src/Volo.Abp.Http.Abstractions/Volo/Abp/Http/ClientProxyExceptionEventData.cs +++ b/framework/src/Volo.Abp.Http.Abstractions/Volo/Abp/Http/ClientProxyExceptionEventData.cs @@ -4,5 +4,5 @@ public class ClientProxyExceptionEventData { public int? StatusCode { get; set; } - public string ReasonPhrase { get; set; } + public string? ReasonPhrase { get; set; } } diff --git a/framework/src/Volo.Abp.Http.Client.Dapr/Volo.Abp.Http.Client.Dapr.csproj b/framework/src/Volo.Abp.Http.Client.Dapr/Volo.Abp.Http.Client.Dapr.csproj index 0d22e68b97..1fd0b7b07b 100644 --- a/framework/src/Volo.Abp.Http.Client.Dapr/Volo.Abp.Http.Client.Dapr.csproj +++ b/framework/src/Volo.Abp.Http.Client.Dapr/Volo.Abp.Http.Client.Dapr.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable diff --git a/framework/src/Volo.Abp.Http.Client.Dapr/Volo/Abp/Http/Client/Dapr/AbpInvocationHandler.cs b/framework/src/Volo.Abp.Http.Client.Dapr/Volo/Abp/Http/Client/Dapr/AbpInvocationHandler.cs index 9ebfb5665d..4a17c3b67a 100644 --- a/framework/src/Volo.Abp.Http.Client.Dapr/Volo/Abp/Http/Client/Dapr/AbpInvocationHandler.cs +++ b/framework/src/Volo.Abp.Http.Client.Dapr/Volo/Abp/Http/Client/Dapr/AbpInvocationHandler.cs @@ -12,7 +12,7 @@ public class AbpInvocationHandler : InvocationHandler, ITransientDependency { if (!daprOptions.Value.HttpEndpoint.IsNullOrWhiteSpace()) { - DaprEndpoint = daprOptions.Value.HttpEndpoint; + DaprEndpoint = daprOptions.Value.HttpEndpoint!; } } } diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo.Abp.Http.Client.IdentityModel.MauiBlazor.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo.Abp.Http.Client.IdentityModel.MauiBlazor.csproj index 671fd3db2d..4a92cc975d 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo.Abp.Http.Client.IdentityModel.MauiBlazor.csproj +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo.Abp.Http.Client.IdentityModel.MauiBlazor.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.Http.Client.IdentityModel.MauiBlazor $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo/Abp/Http/Client/IdentityModel/MauiBlazor/MauiBlazorAbpAccessTokenProvider.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo/Abp/Http/Client/IdentityModel/MauiBlazor/MauiBlazorAbpAccessTokenProvider.cs index 8afbcbafed..3f923aa9bb 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo/Abp/Http/Client/IdentityModel/MauiBlazor/MauiBlazorAbpAccessTokenProvider.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo/Abp/Http/Client/IdentityModel/MauiBlazor/MauiBlazorAbpAccessTokenProvider.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.Http.Client.IdentityModel.MauiBlazor; [Dependency(ReplaceServices = true)] public class MauiBlazorAbpAccessTokenProvider : IAbpAccessTokenProvider, ITransientDependency { - public virtual Task GetTokenAsync() + public virtual Task GetTokenAsync() { return Task.FromResult(null as string); } diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj index 4fc1525e59..05d1a14ef8 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.Http.Client.IdentityModel.Web Volo.Abp.Http.Client.IdentityModel.Web $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextAbpAccessTokenProvider.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextAbpAccessTokenProvider.cs index 97d88bd3b0..5044513438 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextAbpAccessTokenProvider.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextAbpAccessTokenProvider.cs @@ -16,7 +16,7 @@ public class HttpContextAbpAccessTokenProvider : IAbpAccessTokenProvider, ITrans HttpContextAccessor = httpContextAccessor; } - public virtual async Task GetTokenAsync() + public virtual async Task GetTokenAsync() { var httpContext = HttpContextAccessor?.HttpContext; if (httpContext == null) diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj index e98f5d92ff..42d60909bc 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.Http.Client.IdentityModel.WebAssembly Volo.Abp.Http.Client.IdentityModel.WebAssembly $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/WebAssemblyAbpAccessTokenProvider.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/WebAssemblyAbpAccessTokenProvider.cs index d0a68cdb7c..137787820b 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/WebAssemblyAbpAccessTokenProvider.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/WebAssemblyAbpAccessTokenProvider.cs @@ -8,14 +8,14 @@ namespace Volo.Abp.Http.Client.IdentityModel.WebAssembly; [Dependency(ReplaceServices = true)] public class WebAssemblyAbpAccessTokenProvider : IAbpAccessTokenProvider, ITransientDependency { - protected IAccessTokenProvider AccessTokenProvider { get; } + protected IAccessTokenProvider? AccessTokenProvider { get; } public WebAssemblyAbpAccessTokenProvider(IAccessTokenProvider accessTokenProvider) { AccessTokenProvider = accessTokenProvider; } - public virtual async Task GetTokenAsync() + public virtual async Task GetTokenAsync() { if (AccessTokenProvider == null) { diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj index 083e987d49..3e791a1e69 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Http.Client.IdentityModel Volo.Abp.Http.Client.IdentityModel $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/RemoteServiceConfigurationExtensions.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/RemoteServiceConfigurationExtensions.cs index 417875619b..58c4b71078 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/RemoteServiceConfigurationExtensions.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/RemoteServiceConfigurationExtensions.cs @@ -8,8 +8,7 @@ public static class RemoteServiceConfigurationExtensions public const string IdentityClientName = "IdentityClient"; public const string UseCurrentAccessTokenName = "UseCurrentAccessToken"; - [CanBeNull] - public static string GetIdentityClient([NotNull] this RemoteServiceConfiguration configuration) + public static string? GetIdentityClient([NotNull] this RemoteServiceConfiguration configuration) { Check.NotNullOrEmpty(configuration, nameof(configuration)); diff --git a/framework/src/Volo.Abp.Http.Client.Web/Volo.Abp.Http.Client.Web.csproj b/framework/src/Volo.Abp.Http.Client.Web/Volo.Abp.Http.Client.Web.csproj index 68bbbd1157..63da778ecd 100644 --- a/framework/src/Volo.Abp.Http.Client.Web/Volo.Abp.Http.Client.Web.csproj +++ b/framework/src/Volo.Abp.Http.Client.Web/Volo.Abp.Http.Client.Web.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.Http.Client.Web Volo.Abp.Http.Client.Web $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Http.Client.Web/Volo/Abp/Http/Client/Web/Conventions/AbpHttpClientProxyServiceConvention.cs b/framework/src/Volo.Abp.Http.Client.Web/Volo/Abp/Http/Client/Web/Conventions/AbpHttpClientProxyServiceConvention.cs index 49080939c2..a7a2aad343 100644 --- a/framework/src/Volo.Abp.Http.Client.Web/Volo/Abp/Http/Client/Web/Conventions/AbpHttpClientProxyServiceConvention.cs +++ b/framework/src/Volo.Abp.Http.Client.Web/Volo/Abp/Http/Client/Web/Conventions/AbpHttpClientProxyServiceConvention.cs @@ -69,7 +69,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention if (controllerApiDescription != null && !controllerApiDescription.ControllerGroupName.IsNullOrWhiteSpace()) { - controller.ControllerName = controllerApiDescription.ControllerGroupName; + controller.ControllerName = controllerApiDescription.ControllerGroupName!; } ConfigureClientProxySelector(controller); @@ -115,7 +115,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention { var selector = controller.Selectors.FirstOrDefault(); selector?.EndpointMetadata.Add(new AreaAttribute(moduleApiDescription.RootPath)); - controller.RouteValues.Add(new KeyValuePair("area", moduleApiDescription.RootPath)); + controller.RouteValues.Add(new KeyValuePair("area", moduleApiDescription.RootPath)); } var controllerType = controller.ControllerType.AsType(); @@ -163,7 +163,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention var abpServiceSelectorModel = new SelectorModel { AttributeRouteModel = new AttributeRouteModel(new RouteAttribute(template: actionApiDescriptionModel.Url)), - ActionConstraints = { new HttpMethodActionConstraint(new[] { actionApiDescriptionModel.HttpMethod }) } + ActionConstraints = { new HttpMethodActionConstraint(new[] { actionApiDescriptionModel.HttpMethod! }) } }; action.Selectors.Add(abpServiceSelectorModel); @@ -190,7 +190,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention if (!selector.ActionConstraints.OfType().Any()) { - selector.ActionConstraints.Add(new HttpMethodActionConstraint(new[] { httpMethod })); + selector.ActionConstraints.Add(new HttpMethodActionConstraint(new[] { httpMethod! })); } } } @@ -226,7 +226,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention } } - protected virtual ModuleApiDescriptionModel FindModuleApiDescriptionModel(ControllerModel controller) + protected virtual ModuleApiDescriptionModel? FindModuleApiDescriptionModel(ControllerModel controller) { var appServiceType = FindAppServiceInterfaceType(controller); if (appServiceType == null) @@ -246,7 +246,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention return null; } - protected virtual ControllerApiDescriptionModel FindControllerApiDescriptionModel(ControllerModel controller) + protected virtual ControllerApiDescriptionModel? FindControllerApiDescriptionModel(ControllerModel controller) { var appServiceType = FindAppServiceInterfaceType(controller); if (appServiceType == null) @@ -266,7 +266,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention return null; } - protected virtual ActionApiDescriptionModel FindActionApiDescriptionModel(ControllerModel controller, ActionModel action) + protected virtual ActionApiDescriptionModel? FindActionApiDescriptionModel(ControllerModel controller, ActionModel action) { var appServiceType = FindAppServiceInterfaceType(controller); if (appServiceType == null) @@ -285,7 +285,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention return null; } - if (actionApiDescriptionModel.ImplementFrom.StartsWith("Volo.Abp.Application.Services")) + if (actionApiDescriptionModel.ImplementFrom!.StartsWith("Volo.Abp.Application.Services")) { return actionApiDescriptionModel; } @@ -298,7 +298,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention return null; } - protected virtual Type FindAppServiceInterfaceType(ControllerModel controller) + protected virtual Type? FindAppServiceInterfaceType(ControllerModel controller) { return controller.ControllerType.GetInterfaces() .FirstOrDefault(type => !type.IsGenericType && diff --git a/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionHttpClientProxyExtensions.cs b/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionHttpClientProxyExtensions.cs index 3f71924f9d..ab8d5974a8 100644 --- a/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionHttpClientProxyExtensions.cs +++ b/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionHttpClientProxyExtensions.cs @@ -191,7 +191,7 @@ public static class ServiceCollectionHttpClientProxyExtensions return Activator.CreateInstance( typeof(HttpClientProxy<>).MakeGenericType(type), service - ); + )!; }); return services; diff --git a/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj b/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj index 0b4e3ad76f..0b05d8b1c7 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj +++ b/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Http.Client Volo.Abp.Http.Client $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IAbpAccessTokenProvider.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IAbpAccessTokenProvider.cs index a4e9e650e3..ceadc832ec 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IAbpAccessTokenProvider.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IAbpAccessTokenProvider.cs @@ -4,5 +4,5 @@ namespace Volo.Abp.Http.Client.Authentication; public interface IAbpAccessTokenProvider { - Task GetTokenAsync(); + Task GetTokenAsync(); } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/NullAbpAccessTokenProvider.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/NullAbpAccessTokenProvider.cs index 6bd7e6344b..47ae349bf0 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/NullAbpAccessTokenProvider.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/NullAbpAccessTokenProvider.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Http.Client.Authentication; public class NullAbpAccessTokenProvider : IAbpAccessTokenProvider, ITransientDependency { - public Task GetTokenAsync() + public Task GetTokenAsync() { return Task.FromResult(null as string); } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs index f7b9b838b5..e8da52f3b1 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs @@ -17,7 +17,7 @@ public class ClientProxyApiDescriptionFinder : IClientProxyApiDescriptionFinder, protected IVirtualFileProvider VirtualFileProvider { get; } protected IJsonSerializer JsonSerializer { get; } protected Dictionary ActionApiDescriptionModels { get; } - protected ApplicationApiDescriptionModel ApplicationApiDescriptionModel { get; set; } + protected ApplicationApiDescriptionModel ApplicationApiDescriptionModel { get; set; } = default!; public ClientProxyApiDescriptionFinder( IVirtualFileProvider virtualFileProvider, @@ -30,7 +30,7 @@ public class ClientProxyApiDescriptionFinder : IClientProxyApiDescriptionFinder, Initialize(); } - public ActionApiDescriptionModel FindAction(string methodName) + public ActionApiDescriptionModel? FindAction(string methodName) { return ActionApiDescriptionModels.ContainsKey(methodName) ? ActionApiDescriptionModels[methodName] : null; } @@ -113,7 +113,7 @@ public class ClientProxyApiDescriptionFinder : IClientProxyApiDescriptionFinder, return rootPath + physicalDirectoryInfo.Name.EnsureStartsWith('/'); } - return fileInfo.PhysicalPath; + return fileInfo.PhysicalPath!; } private string GetProxyFileInfoPath(string rootPath, IFileInfo fileInfo) @@ -123,6 +123,6 @@ public class ClientProxyApiDescriptionFinder : IClientProxyApiDescriptionFinder, return rootPath + physicalFileInfo.Name.EnsureStartsWith('/'); } - return fileInfo.GetVirtualOrPhysicalPathOrNull(); + return fileInfo.GetVirtualOrPhysicalPathOrNull()!; } } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs index 5c1d893bfd..8dee0fcc3e 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Http.Client.ClientProxying; public class ClientProxyBase : ITransientDependency { - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!; protected IClientProxyApiDescriptionFinder ClientProxyApiDescriptionFinder => LazyServiceProvider.LazyGetRequiredService(); protected ICancellationTokenProvider CancellationTokenProvider => LazyServiceProvider.LazyGetRequiredService(); @@ -42,17 +42,17 @@ public class ClientProxyBase : ITransientDependency protected ICurrentApiVersionInfo CurrentApiVersionInfo => LazyServiceProvider.LazyGetRequiredService(); protected ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService(); - protected virtual async Task RequestAsync(string methodName, ClientProxyRequestTypeValue arguments = null) + protected virtual async Task RequestAsync(string methodName, ClientProxyRequestTypeValue? arguments = null) { await RequestAsync(BuildHttpProxyClientProxyContext(methodName, arguments)); } - protected virtual async Task RequestAsync(string methodName, ClientProxyRequestTypeValue arguments = null) + protected virtual async Task RequestAsync(string methodName, ClientProxyRequestTypeValue? arguments = null) { return await RequestAsync(BuildHttpProxyClientProxyContext(methodName, arguments)); } - protected virtual ClientProxyRequestContext BuildHttpProxyClientProxyContext(string methodName, ClientProxyRequestTypeValue arguments = null) + protected virtual ClientProxyRequestContext BuildHttpProxyClientProxyContext(string methodName, ClientProxyRequestTypeValue? arguments = null) { if (arguments == null) { @@ -67,7 +67,7 @@ public class ClientProxyBase : ITransientDependency } var actionArguments = action.Parameters.GroupBy(x => x.NameOnMethod).ToList(); - if (action.SupportedVersions.Any()) + if (action.SupportedVersions != null && action.SupportedVersions.Any()) { //TODO: make names configurable actionArguments.RemoveAll(x => x.Key == "api-version" || x.Key == "apiVersion"); @@ -107,7 +107,7 @@ public class ClientProxyBase : ITransientDependency if (stringContent.IsNullOrWhiteSpace()) { - return default; + return default!; } return JsonSerializer.Deserialize(stringContent); @@ -177,7 +177,7 @@ public class ClientProxyBase : ITransientDependency var versionParam = requestContext.Action.Parameters.FirstOrDefault(p => p.Name == "apiVersion" && p.BindingSourceId == ParameterBindingSources.Path) ?? requestContext.Action.Parameters.FirstOrDefault(p => p.Name == "api-version" && p.BindingSourceId == ParameterBindingSources.Query); - return new ApiVersionInfo(versionParam?.BindingSourceId, apiVersion); + return new ApiVersionInfo(versionParam?.BindingSourceId!, apiVersion); } protected virtual async Task GetUrlWithParametersAsync(ClientProxyRequestContext requestContext, ApiVersionInfo apiVersion) @@ -185,7 +185,7 @@ public class ClientProxyBase : ITransientDependency return await ClientProxyUrlBuilder.GenerateUrlWithParametersAsync(requestContext.Action, requestContext.Arguments, apiVersion); } - protected virtual async Task GetHttpContentAsync(ClientProxyRequestContext requestContext, ApiVersionInfo apiVersion) + protected virtual async Task GetHttpContentAsync(ClientProxyRequestContext requestContext, ApiVersionInfo apiVersion) { return await ClientProxyRequestPayloadBuilder.BuildContentAsync(requestContext.Action, requestContext.Arguments, JsonSerializer, apiVersion); } @@ -199,15 +199,15 @@ public class ClientProxyBase : ITransientDependency return configuredVersion ?? "1.0"; } - if (requestContext.Action.SupportedVersions.Contains(configuredVersion)) + if (requestContext.Action.SupportedVersions!.Contains(configuredVersion!)) { - return configuredVersion; + return configuredVersion!; } return requestContext.Action.SupportedVersions.Last(); //TODO: Ensure to get the latest version! } - protected virtual async Task GetConfiguredApiVersionAsync(ClientProxyRequestContext requestContext) + protected virtual async Task GetConfiguredApiVersionAsync(ClientProxyRequestContext requestContext) { var clientConfig = ClientOptions.Value.HttpClientProxies.GetOrDefault(requestContext.ServiceType) ?? throw new AbpException($"Could not get DynamicHttpClientProxyConfig for {requestContext.ServiceType.FullName}."); @@ -220,8 +220,8 @@ public class ClientProxyBase : ITransientDependency { await LocalEventBus.PublishAsync(new ClientProxyExceptionEventData() { - StatusCode = (int?)response?.StatusCode, - ReasonPhrase = response?.ReasonPhrase + StatusCode = (int?)response.StatusCode, + ReasonPhrase = response.ReasonPhrase }); if (response.Headers.Contains(AbpHttpConsts.AbpErrorFormat)) diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyRequestPayloadBuilder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyRequestPayloadBuilder.cs index abbbb8b6f1..d7755a1ac9 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyRequestPayloadBuilder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyRequestPayloadBuilder.cs @@ -40,8 +40,7 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency HttpClientProxyingOptions = httpClientProxyingOptions.Value; } - [CanBeNull] - public virtual async Task BuildContentAsync(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments, IJsonSerializer jsonSerializer, ApiVersionInfo apiVersion) + public virtual async Task BuildContentAsync(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments, IJsonSerializer jsonSerializer, ApiVersionInfo apiVersion) { var body = await GenerateBodyAsync(action, methodArguments, jsonSerializer); if (body != null) @@ -54,7 +53,7 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency return body; } - protected virtual Task GenerateBodyAsync(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments, IJsonSerializer jsonSerializer) + protected virtual Task GenerateBodyAsync(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments, IJsonSerializer jsonSerializer) { var parameters = action .Parameters @@ -63,7 +62,7 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency if (parameters.Length <= 0) { - return Task.FromResult(null); + return Task.FromResult(null); } if (parameters.Length > 1) @@ -76,13 +75,13 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency var value = HttpActionParameterHelper.FindParameterValue(methodArguments, parameters[0]); if (value == null) { - return Task.FromResult(null); + return Task.FromResult(null); } - return Task.FromResult(new StringContent(jsonSerializer.Serialize(value), Encoding.UTF8, MimeTypes.Application.Json)); + return Task.FromResult(new StringContent(jsonSerializer.Serialize(value), Encoding.UTF8, MimeTypes.Application.Json)); } - protected virtual async Task GenerateFormPostDataAsync(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments) + protected virtual async Task GenerateFormPostDataAsync(ActionApiDescriptionModel action, IReadOnlyDictionary methodArguments) { var parameters = action .Parameters @@ -108,7 +107,7 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency { using (var scope = ServiceScopeFactory.CreateScope()) { - var formDataContents = await (Task>>)CallObjectToFormDataAsyncMethod + var formDataContents = await (Task>?>)CallObjectToFormDataAsyncMethod .MakeGenericMethod(value.GetType()) .Invoke(this, new object[] { @@ -116,7 +115,7 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency action, parameter, value - }); + })!; if (formDataContents != null) { @@ -158,12 +157,12 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency { foreach (var item in (IEnumerable) value) { - formData.Add(new StringContent(item.ToString(), Encoding.UTF8), parameter.Name); + formData.Add(new StringContent(item.ToString()!, Encoding.UTF8), parameter.Name); } } else { - formData.Add(new StringContent(value.ToString(), Encoding.UTF8), parameter.Name); + formData.Add(new StringContent(value.ToString()!, Encoding.UTF8), parameter.Name); } } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyUrlBuilder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyUrlBuilder.cs index 63ddd75510..65703dc56b 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyUrlBuilder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyUrlBuilder.cs @@ -100,15 +100,15 @@ public class ClientProxyUrlBuilder : ITransientDependency { using (var scope = ServiceScopeFactory.CreateScope()) { - var path = await (Task)CallObjectToPathAsyncMethod + var path = await (Task)CallObjectToPathAsyncMethod .MakeGenericMethod(value.GetType()) - .Invoke(this, new object[] + .Invoke(this, new object?[] { scope.ServiceProvider.GetRequiredService(HttpClientProxyingOptions.PathConverts[value.GetType()]), action, pathParameter, value - }); + })!; if (path != null) { @@ -143,7 +143,7 @@ public class ClientProxyUrlBuilder : ITransientDependency { using (var scope = ServiceScopeFactory.CreateScope()) { - var queryString = await (Task)CallObjectToQueryStringAsyncMethod + var queryString = await (Task)CallObjectToQueryStringAsyncMethod .MakeGenericMethod(value.GetType()) .Invoke(this, new object[] { @@ -151,7 +151,7 @@ public class ClientProxyUrlBuilder : ITransientDependency action, queryStringParameter, value - }); + })!; if (queryString != null) { @@ -218,11 +218,11 @@ public class ClientProxyUrlBuilder : ITransientDependency return true; } - protected virtual Task ConvertValueToStringAsync([CanBeNull] object value) + protected virtual Task ConvertValueToStringAsync(object? value) { if (value is DateTime dateTimeValue) { - return Task.FromResult(dateTimeValue.ToUniversalTime().ToString("O")); + return Task.FromResult(dateTimeValue.ToUniversalTime().ToString("O"))!; } return Task.FromResult(value?.ToString()); diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/CurrentApiVersionInfo.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/CurrentApiVersionInfo.cs index f56e9e893a..7c0bac4c81 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/CurrentApiVersionInfo.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/CurrentApiVersionInfo.cs @@ -6,11 +6,11 @@ namespace Volo.Abp.Http.Client.ClientProxying; public class CurrentApiVersionInfo : ICurrentApiVersionInfo, ISingletonDependency { - public ApiVersionInfo ApiVersionInfo => _currentApiVersionInfo.Value; + public ApiVersionInfo? ApiVersionInfo => _currentApiVersionInfo.Value; - private readonly AsyncLocal _currentApiVersionInfo = new AsyncLocal(); + private readonly AsyncLocal _currentApiVersionInfo = new AsyncLocal(); - public virtual IDisposable Change(ApiVersionInfo apiVersionInfo) + public virtual IDisposable Change(ApiVersionInfo? apiVersionInfo) { var parent = ApiVersionInfo; _currentApiVersionInfo.Value = apiVersionInfo; diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/IClientProxyApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/IClientProxyApiDescriptionFinder.cs index baf1d6facf..4394b92bcc 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/IClientProxyApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/IClientProxyApiDescriptionFinder.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.Http.Client.ClientProxying; public interface IClientProxyApiDescriptionFinder { - ActionApiDescriptionModel FindAction(string methodName); + ActionApiDescriptionModel? FindAction(string methodName); ApplicationApiDescriptionModel GetApiDescription(); } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ICurrentApiVersionInfo.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ICurrentApiVersionInfo.cs index 9a8fe264bf..e5ac53fafe 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ICurrentApiVersionInfo.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ICurrentApiVersionInfo.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.Http.Client.ClientProxying; public interface ICurrentApiVersionInfo { - ApiVersionInfo ApiVersionInfo { get; } + ApiVersionInfo? ApiVersionInfo { get; } - IDisposable Change(ApiVersionInfo apiVersionInfo); + IDisposable Change(ApiVersionInfo? apiVersionInfo); } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index f01ada7127..44f005add9 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -118,7 +118,7 @@ public class ApiDescriptionFinder : IApiDescriptionFinder, ITransientDependency var content = await response.Content.ReadAsStringAsync(); - var result = JsonSerializer.Deserialize(content, DeserializeOptions); + var result = JsonSerializer.Deserialize(content, DeserializeOptions)!; return result; } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs index 9c30c84496..0f5a9e3642 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs @@ -66,7 +66,7 @@ public class DynamicHttpProxyInterceptor : AbpInterceptor, ITransientD var returnType = invocation.Method.ReturnType.GenericTypeArguments[0]; var result = (Task)CallRequestAsyncMethod .MakeGenericMethod(returnType) - .Invoke(this, new object[] { context }); + .Invoke(this, new object[] { context })!; invocation.ReturnValue = await GetResultAsync(result, returnType); } @@ -99,6 +99,6 @@ public class DynamicHttpProxyInterceptor : AbpInterceptor, ITransientD .MakeGenericType(resultType) .GetProperty(nameof(Task.Result), BindingFlags.Instance | BindingFlags.Public); Check.NotNull(resultProperty, nameof(resultProperty)); - return resultProperty.GetValue(task); + return resultProperty!.GetValue(task)!; } } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Proxying/HttpActionParameterHelper.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Proxying/HttpActionParameterHelper.cs index d5d5c4d971..f9fc79b81f 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Proxying/HttpActionParameterHelper.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Proxying/HttpActionParameterHelper.cs @@ -6,7 +6,7 @@ namespace Volo.Abp.Http.Client.Proxying; internal static class HttpActionParameterHelper { - public static object FindParameterValue(IReadOnlyDictionary methodArguments, ParameterApiDescriptionModel apiParameter) + public static object? FindParameterValue(IReadOnlyDictionary methodArguments, ParameterApiDescriptionModel apiParameter) { var value = methodArguments.GetOrDefault(apiParameter.NameOnMethod); if (value == null) diff --git a/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj b/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj index 3b029e3b9d..11cdaffe09 100644 --- a/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj +++ b/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Http Volo.Abp.Http $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs index 603b6797c3..78ee75e901 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs @@ -43,12 +43,12 @@ public static class HttpMethodHelper return methodName; } - return methodName.RemovePreFix(prefixes); + return methodName.RemovePreFix(prefixes!); } - public static HttpMethod ConvertToHttpMethod(string httpMethod) + public static HttpMethod ConvertToHttpMethod(string? httpMethod) { - switch (httpMethod.ToUpperInvariant()) + switch (httpMethod?.ToUpperInvariant()) { case "GET": return HttpMethod.Get; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs index 9e1d208ddf..890637d801 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs @@ -10,32 +10,32 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ActionApiDescriptionModel { - public string UniqueName { get; set; } + public string UniqueName { get; set; } = default!; - public string Name { get; set; } + public string Name { get; set; } = default!; - public string HttpMethod { get; set; } + public string? HttpMethod { get; set; } - public string Url { get; set; } + public string Url { get; set; } = default!; - public IList SupportedVersions { get; set; } + public IList? SupportedVersions { get; set; } - public IList ParametersOnMethod { get; set; } + public IList ParametersOnMethod { get; set; } = default!; - public IList Parameters { get; set; } + public IList Parameters { get; set; } = default!; - public ReturnValueApiDescriptionModel ReturnValue { get; set; } + public ReturnValueApiDescriptionModel ReturnValue { get; set; } = default!; public bool? AllowAnonymous { get; set; } - public string ImplementFrom { get; set; } + public string? ImplementFrom { get; set; } public ActionApiDescriptionModel() { } - public static ActionApiDescriptionModel Create([NotNull] string uniqueName, [NotNull] MethodInfo method, [NotNull] string url, [CanBeNull] string httpMethod, [NotNull] IList supportedVersions, bool? allowAnonymous = null, string implementFrom = null) + public static ActionApiDescriptionModel Create([NotNull] string uniqueName, [NotNull] MethodInfo method, [NotNull] string url, string? httpMethod, [NotNull] IList supportedVersions, bool? allowAnonymous = null, string? implementFrom = null) { Check.NotNull(uniqueName, nameof(uniqueName)); Check.NotNull(method, nameof(method)); diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs index 6907287f88..a9062655d0 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs @@ -17,16 +17,16 @@ public static class ApiTypeNameHelper if (TypeHelper.IsDictionary(type, out var keyType, out var valueType)) { - if (!duplicateTypes.Contains(keyType) && !duplicateTypes.Contains(valueType)) + if (!duplicateTypes.Contains(keyType!) && !duplicateTypes.Contains(valueType!)) { - return $"{{{GetTypeName(keyType, duplicateTypes)}:{GetTypeName(valueType, duplicateTypes)}}}"; + return $"{{{GetTypeName(keyType!, duplicateTypes)}:{GetTypeName(valueType!, duplicateTypes)}}}"; } } else if (TypeHelper.IsEnumerable(type, out var itemType, includePrimitives: false)) { - if (!duplicateTypes.Contains(itemType)) + if (!duplicateTypes.Contains(itemType!)) { - return $"[{GetTypeName(itemType, duplicateTypes)}]"; + return $"[{GetTypeName(itemType!, duplicateTypes)}]"; } } @@ -44,16 +44,16 @@ public static class ApiTypeNameHelper if (TypeHelper.IsDictionary(type, out var keyType, out var valueType)) { - if (!duplicateTypes.Contains(keyType) && !duplicateTypes.Contains(valueType)) + if (!duplicateTypes.Contains(keyType!) && !duplicateTypes.Contains(valueType!)) { - return $"{{{GetSimpleTypeName(keyType, duplicateTypes)}:{GetSimpleTypeName(valueType, duplicateTypes)}}}"; + return $"{{{GetSimpleTypeName(keyType!, duplicateTypes)}:{GetSimpleTypeName(valueType!, duplicateTypes)}}}"; } } else if (TypeHelper.IsEnumerable(type, out var itemType, includePrimitives: false)) { - if (!duplicateTypes.Contains(itemType)) + if (!duplicateTypes.Contains(itemType!)) { - return $"[{GetSimpleTypeName(itemType, duplicateTypes)}]"; + return $"[{GetSimpleTypeName(itemType!, duplicateTypes)}]"; } } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs index edebd656cb..03b3751125 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs @@ -8,9 +8,9 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ApplicationApiDescriptionModel { - public IDictionary Modules { get; set; } + public IDictionary Modules { get; set; } = default!; - public IDictionary Types { get; set; } + public IDictionary Types { get; set; } = default!; public ApplicationApiDescriptionModel() { @@ -41,7 +41,7 @@ public class ApplicationApiDescriptionModel return Modules.GetOrAdd(rootPath, () => ModuleApiDescriptionModel.Create(rootPath, remoteServiceName)); } - public ApplicationApiDescriptionModel CreateSubModel(string[] modules = null, string[] controllers = null, string[] actions = null) + public ApplicationApiDescriptionModel CreateSubModel(string[]? modules = null, string[]? controllers = null, string[]? actions = null) { var subModel = ApplicationApiDescriptionModel.Create(); ; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs index e2e0e53e9f..97919e54ba 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs @@ -8,28 +8,28 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ControllerApiDescriptionModel { - public string ControllerName { get; set; } + public string ControllerName { get; set; } = default!; - public string ControllerGroupName { get; set; } + public string? ControllerGroupName { get; set; } public bool IsRemoteService { get; set; } public bool IsIntegrationService { get; set; } - public string ApiVersion { get; set; } + public string? ApiVersion { get; set; } - public string Type { get; set; } + public string Type { get; set; } = default!; - public List Interfaces { get; set; } + public List Interfaces { get; set; } = default!; - public Dictionary Actions { get; set; } + public Dictionary Actions { get; set; } = default!; public ControllerApiDescriptionModel() { } - public static ControllerApiDescriptionModel Create(string controllerName, string groupName, bool isRemoteService, bool isIntegrationService, string apiVersion, Type type, [CanBeNull] HashSet ignoredInterfaces = null) + public static ControllerApiDescriptionModel Create(string controllerName, string? groupName, bool isRemoteService, bool isIntegrationService, string? apiVersion, Type type, HashSet? ignoredInterfaces = null) { return new ControllerApiDescriptionModel { @@ -38,11 +38,11 @@ public class ControllerApiDescriptionModel IsRemoteService = isRemoteService, IsIntegrationService = isIntegrationService, //IntegrationServiceAttribute.IsDefinedOrInherited(type), ApiVersion = apiVersion, - Type = type.FullName, + Type = type.FullName!, Actions = new Dictionary(), Interfaces = type .GetInterfaces() - .WhereIf(ignoredInterfaces != null, i => !i.IsGenericType && !ignoredInterfaces.Contains(i)) + .WhereIf(ignoredInterfaces != null, i => !i.IsGenericType && !ignoredInterfaces!.Contains(i)) .Select(ControllerInterfaceApiDescriptionModel.Create) .ToList() }; @@ -60,7 +60,7 @@ public class ControllerApiDescriptionModel return Actions[uniqueName] = action; } - public ControllerApiDescriptionModel CreateSubModel(string[] actions) + public ControllerApiDescriptionModel CreateSubModel(string[]? actions) { var subModel = new ControllerApiDescriptionModel { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs index a0cfe31e26..a95e2ac547 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs @@ -8,11 +8,11 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ControllerInterfaceApiDescriptionModel { - public string Type { get; set; } + public string Type { get; set; } = default!; - public string Name { get; set; } + public string Name { get; set; } = default!; - public InterfaceMethodApiDescriptionModel[] Methods { get; set; } + public InterfaceMethodApiDescriptionModel[] Methods { get; set; } = default!; public ControllerInterfaceApiDescriptionModel() { @@ -23,7 +23,7 @@ public class ControllerInterfaceApiDescriptionModel { var model = new ControllerInterfaceApiDescriptionModel { - Type = type.FullName, + Type = type.FullName!, Name = type.Name }; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs index 53a4349854..32b79ce3e1 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs @@ -9,11 +9,11 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class InterfaceMethodApiDescriptionModel { - public string Name { get; set; } + public string Name { get; set; } = default!; - public IList ParametersOnMethod { get; set; } + public IList ParametersOnMethod { get; set; } = default!; - public ReturnValueApiDescriptionModel ReturnValue { get; set; } + public ReturnValueApiDescriptionModel ReturnValue { get; set; } = default!; public InterfaceMethodApiDescriptionModel() { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs index ed1de76c0e..c3ff20b897 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs @@ -7,17 +7,17 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class MethodParameterApiDescriptionModel { - public string Name { get; set; } + public string Name { get; set; } = default!; - public string TypeAsString { get; set; } + public string TypeAsString { get; set; } = default!; - public string Type { get; set; } + public string Type { get; set; } = default!; - public string TypeSimple { get; set; } + public string TypeSimple { get; set; } = default!; public bool IsOptional { get; set; } - public object DefaultValue { get; set; } + public object? DefaultValue { get; set; } public MethodParameterApiDescriptionModel() { @@ -28,7 +28,7 @@ public class MethodParameterApiDescriptionModel { return new MethodParameterApiDescriptionModel { - Name = parameterInfo.Name, + Name = parameterInfo.Name!, TypeAsString = parameterInfo.ParameterType.GetFullNameWithAssemblyName(), Type = TypeHelper.GetFullNameHandlingNullableAndGenerics(parameterInfo.ParameterType), TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(parameterInfo.ParameterType), diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs index bb2c25e3eb..3a7607376c 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs @@ -18,11 +18,11 @@ public class ModuleApiDescriptionModel /// public const string DefaultRemoteServiceName = "Default"; - public string RootPath { get; set; } + public string RootPath { get; set; } = default!; - public string RemoteServiceName { get; set; } + public string RemoteServiceName { get; set; } = default!; - public IDictionary Controllers { get; set; } + public IDictionary Controllers { get; set; } = default!; public ModuleApiDescriptionModel() { @@ -49,13 +49,13 @@ public class ModuleApiDescriptionModel return Controllers[controller.Type] = controller; } - public ControllerApiDescriptionModel GetOrAddController(string name, string groupName, bool isRemoteService, bool isIntegrationService, string apiVersion, Type type, [CanBeNull] HashSet ignoredInterfaces = null) + public ControllerApiDescriptionModel GetOrAddController(string name, string? groupName, bool isRemoteService, bool isIntegrationService, string? apiVersion, Type type, HashSet? ignoredInterfaces = null) { - var key = apiVersion.IsNullOrWhiteSpace() ? type.FullName : $"{apiVersion + "."}{type.FullName}"; + var key = (apiVersion.IsNullOrWhiteSpace() ? type.FullName : $"{apiVersion + "."}{type.FullName}")!; return Controllers.GetOrAdd(key, () => ControllerApiDescriptionModel.Create(name, groupName, isRemoteService, isIntegrationService, apiVersion, type, ignoredInterfaces)); } - public ModuleApiDescriptionModel CreateSubModel(string[] controllers, string[] actions) + public ModuleApiDescriptionModel CreateSubModel(string[]? controllers, string[]? actions) { var subModel = Create(RootPath, RemoteServiceName); diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs index cf080a857e..a863d1bfad 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs @@ -6,32 +6,32 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ParameterApiDescriptionModel { - public string NameOnMethod { get; set; } + public string NameOnMethod { get; set; } = default!; - public string Name { get; set; } + public string Name { get; set; } = default!; - public string JsonName { get; set; } + public string? JsonName { get; set; } - public string Type { get; set; } + public string? Type { get; set; } - public string TypeSimple { get; set; } + public string? TypeSimple { get; set; } public bool IsOptional { get; set; } - public object DefaultValue { get; set; } + public object? DefaultValue { get; set; } - public string[] ConstraintTypes { get; set; } + public string[]? ConstraintTypes { get; set; } - public string BindingSourceId { get; set; } + public string? BindingSourceId { get; set; } - public string DescriptorName { get; set; } + public string? DescriptorName { get; set; } public ParameterApiDescriptionModel() { } - public static ParameterApiDescriptionModel Create(string name, string jsonName, string nameOnMethod, Type type, bool isOptional = false, object defaultValue = null, string[] constraintTypes = null, string bindingSourceId = null, string descriptorName = null) + public static ParameterApiDescriptionModel Create(string name, string? jsonName, string nameOnMethod, Type type, bool isOptional = false, object? defaultValue = null, string[]? constraintTypes = null, string? bindingSourceId = null, string? descriptorName = null) { return new ParameterApiDescriptionModel { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs index bd3852098b..03aca1fc29 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs @@ -9,13 +9,13 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class PropertyApiDescriptionModel { - public string Name { get; set; } + public string Name { get; set; } = default!; - public string JsonName { get; set; } + public string? JsonName { get; set; } - public string Type { get; set; } + public string Type { get; set; } = default!; - public string TypeSimple { get; set; } + public string TypeSimple { get; set; } = default!; public bool IsRequired { get; set; } @@ -23,11 +23,11 @@ public class PropertyApiDescriptionModel public int? MaxLength { get; set; } - public string Minimum { get; set; } + public string? Minimum { get; set; } - public string Maximum { get; set; } + public string? Maximum { get; set; } - public string Regex { get; set; } + public string? Regex { get; set; } public static PropertyApiDescriptionModel Create(PropertyInfo propertyInfo) { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs index 675eab3c82..e5a7e120a8 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs @@ -7,9 +7,9 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ReturnValueApiDescriptionModel { - public string Type { get; set; } + public string Type { get; set; } = default!; - public string TypeSimple { get; set; } + public string TypeSimple { get; set; } = default!; public ReturnValueApiDescriptionModel() { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs index 6a9faa71d7..eaeb02f002 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs @@ -7,17 +7,17 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class TypeApiDescriptionModel { - public string BaseType { get; set; } + public string? BaseType { get; set; } public bool IsEnum { get; set; } - public string[] EnumNames { get; set; } + public string[]? EnumNames { get; set; } - public object[] EnumValues { get; set; } + public object[]? EnumValues { get; set; } - public string[] GenericArguments { get; set; } + public string[]? GenericArguments { get; set; } - public PropertyApiDescriptionModel[] Properties { get; set; } + public PropertyApiDescriptionModel[]? Properties { get; set; } public TypeApiDescriptionModel() { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs index 86449c8971..eb8ee307b5 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Http.ProxyScripting.Configuration; public static class AbpApiProxyScriptingConfiguration { - public static Func PropertyNameGenerator { get; set; } + public static Func PropertyNameGenerator { get; set; } static AbpApiProxyScriptingConfiguration() { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs index f7383f0465..b5973eed8a 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs @@ -135,16 +135,16 @@ public class JQueryProxyScriptGenerator : IProxyScriptGenerator, ITransientDepen private static string FindBestApiVersion(ActionApiDescriptionModel action) { //var configuredVersion = GetConfiguredApiVersion(); //TODO: Implement - string configuredVersion = null; + string? configuredVersion = null; if (action.SupportedVersions.IsNullOrEmpty()) { return configuredVersion ?? "1.0"; } - if (action.SupportedVersions.Contains(configuredVersion)) + if (action.SupportedVersions!.Contains(configuredVersion!)) { - return configuredVersion; + return configuredVersion!; } return action.SupportedVersions.Last(); //TODO: Ensure to get the latest version! diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs index 4b43eb70c7..40cc5c4719 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs @@ -25,7 +25,7 @@ internal static class ProxyScriptingHelper } } - public static string GenerateHeaders(ActionApiDescriptionModel action, int indent = 0) + public static string? GenerateHeaders(ActionApiDescriptionModel action, int indent = 0) { var parameters = action .Parameters @@ -40,7 +40,7 @@ internal static class ProxyScriptingHelper return ProxyScriptingJsFuncHelper.CreateJsObjectLiteral(parameters, indent); } - public static string GenerateBody(ActionApiDescriptionModel action) + public static string? GenerateBody(ActionApiDescriptionModel action) { var parameters = action .Parameters @@ -62,7 +62,7 @@ internal static class ProxyScriptingHelper return ProxyScriptingJsFuncHelper.GetParamNameInJsFunc(parameters[0]); } - public static string GenerateFormPostData(ActionApiDescriptionModel action, int indent = 0) + public static string? GenerateFormPostData(ActionApiDescriptionModel action, int indent = 0) { var parameters = action .Parameters diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs index b165977076..e3eecb0f60 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs @@ -8,11 +8,11 @@ public class ProxyScriptingModel 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 IDictionary Properties { get; set; } diff --git a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj index a707f58b9c..b0c2b3e567 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj +++ b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.IdentityModel Volo.Abp.IdentityModel $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityClientOptions.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityClientOptions.cs index 364d2dc2ea..62fc21a5fa 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityClientOptions.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityClientOptions.cs @@ -14,7 +14,7 @@ public class AbpIdentityClientOptions IdentityClients = new IdentityClientConfigurationDictionary(); } - public IdentityClientConfiguration GetClientConfiguration(ICurrentTenant currentTenant, string identityClientName = null) + public IdentityClientConfiguration? GetClientConfiguration(ICurrentTenant currentTenant, string? identityClientName = null) { if (identityClientName.IsNullOrWhiteSpace()) { @@ -35,7 +35,7 @@ public class AbpIdentityClientOptions } } - return IdentityClients.GetOrDefault(identityClientName) ?? + return IdentityClients.GetOrDefault(identityClientName!) ?? IdentityClients.Default; } } diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelAuthenticationService.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelAuthenticationService.cs index fee1a032fb..8a5902bdbf 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelAuthenticationService.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelAuthenticationService.cs @@ -9,7 +9,7 @@ public interface IIdentityModelAuthenticationService { Task TryAuthenticateAsync( [NotNull] HttpClient client, - string identityClientName = null); + string? identityClientName = null); Task GetAccessTokenAsync( IdentityClientConfiguration configuration); diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs index 8faf3225ab..011e40b4b3 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs @@ -5,14 +5,14 @@ using IdentityModel; namespace Volo.Abp.IdentityModel; -public class IdentityClientConfiguration : Dictionary +public class IdentityClientConfiguration : Dictionary { /// /// Possible values: "client_credentials" or "password". /// Default value: "client_credentials". /// public string GrantType { - get => this.GetOrDefault(nameof(GrantType)); + get => this.GetOrDefault(nameof(GrantType))!; set => this[nameof(GrantType)] = value; } @@ -20,7 +20,7 @@ public class IdentityClientConfiguration : Dictionary /// Client Id. /// public string ClientId { - get => this.GetOrDefault(nameof(ClientId)); + get => this.GetOrDefault(nameof(ClientId))!; set => this[nameof(ClientId)] = value; } @@ -28,7 +28,7 @@ public class IdentityClientConfiguration : Dictionary /// Client secret (as plain text - without hashed). /// public string ClientSecret { - get => this.GetOrDefault(nameof(ClientSecret)); + get => this.GetOrDefault(nameof(ClientSecret))!; set => this[nameof(ClientSecret)] = value; } @@ -36,7 +36,7 @@ public class IdentityClientConfiguration : Dictionary /// User name. /// Valid only if is "password". /// - public string UserName { + public string? UserName { get => this.GetOrDefault(nameof(UserName)); set => this[nameof(UserName)] = value; } @@ -45,7 +45,7 @@ public class IdentityClientConfiguration : Dictionary /// Password of the . /// Valid only if is "password". /// - public string UserPassword { + public string? UserPassword { get => this.GetOrDefault(nameof(UserPassword)); set => this[nameof(UserPassword)] = value; } @@ -54,7 +54,7 @@ public class IdentityClientConfiguration : Dictionary /// Authority. /// public string Authority { - get => this.GetOrDefault(nameof(Authority)); + get => this.GetOrDefault(nameof(Authority))!; set => this[nameof(Authority)] = value; } @@ -62,7 +62,7 @@ public class IdentityClientConfiguration : Dictionary /// Scope. /// public string Scope { - get => this.GetOrDefault(nameof(Scope)); + get => this.GetOrDefault(nameof(Scope))!; set => this[nameof(Scope)] = value; } @@ -113,8 +113,8 @@ public class IdentityClientConfiguration : Dictionary string clientId, string clientSecret, string grantType = OidcConstants.GrantTypes.ClientCredentials, - string userName = null, - string userPassword = null, + string? userName = null, + string? userPassword = null, bool requireHttps = true, int cacheAbsoluteExpiration = 60 * 30, bool validateIssuerName = true, diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs index e8c42fe390..4993cfa462 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs @@ -2,11 +2,11 @@ namespace Volo.Abp.IdentityModel; -public class IdentityClientConfigurationDictionary : Dictionary +public class IdentityClientConfigurationDictionary : Dictionary { public const string DefaultName = "Default"; - public IdentityClientConfiguration Default { + public IdentityClientConfiguration? Default { get => this.GetOrDefault(DefaultName); set => this[DefaultName] = value; } diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs index 6f5f8eda95..4354d83735 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs @@ -54,7 +54,7 @@ public class IdentityModelAuthenticationService : IIdentityModelAuthenticationSe public async Task TryAuthenticateAsync( [NotNull] HttpClient client, - string identityClientName = null) + string? identityClientName = null) { var accessToken = await GetAccessTokenOrNullAsync(identityClientName); if (accessToken == null) @@ -66,7 +66,7 @@ public class IdentityModelAuthenticationService : IIdentityModelAuthenticationSe return true; } - protected virtual async Task GetAccessTokenOrNullAsync(string identityClientName) + protected virtual async Task GetAccessTokenOrNullAsync(string? identityClientName) { var configuration = ClientOptions.GetClientConfiguration(CurrentTenant, identityClientName); if (configuration == null) diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelDiscoveryDocumentCacheItem.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelDiscoveryDocumentCacheItem.cs index 0fbf50d020..6cabe5d9b9 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelDiscoveryDocumentCacheItem.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelDiscoveryDocumentCacheItem.cs @@ -7,9 +7,9 @@ namespace Volo.Abp.IdentityModel; [IgnoreMultiTenancy] public class IdentityModelDiscoveryDocumentCacheItem { - public string TokenEndpoint { get; set; } + public string TokenEndpoint { get; set; } = default!; - public string DeviceAuthorizationEndpoint { get; set; } + public string DeviceAuthorizationEndpoint { get; set; } = default!; public IdentityModelDiscoveryDocumentCacheItem() { diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpRequestMessageOptions.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpRequestMessageOptions.cs index d72cc9682e..78b2a342f4 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpRequestMessageOptions.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpRequestMessageOptions.cs @@ -5,5 +5,5 @@ namespace Volo.Abp.IdentityModel; public class IdentityModelHttpRequestMessageOptions { - public Action ConfigureHttpRequestMessage { get; set; } + public Action? ConfigureHttpRequestMessage { get; set; } } diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelTokenCacheItem.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelTokenCacheItem.cs index 2a164a23e6..72beed1577 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelTokenCacheItem.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelTokenCacheItem.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.IdentityModel; [Serializable] public class IdentityModelTokenCacheItem { - public string AccessToken { get; set; } + public string AccessToken { get; set; } = default!; public IdentityModelTokenCacheItem() {