Browse Source

Merge pull request #17560 from abpframework/liangshiwei/group13

pull/17565/head
maliming 3 years ago
committed by GitHub
parent
commit
8a32bfc19d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
  2. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
  3. 2
      framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj
  4. 2
      framework/src/Volo.Abp.Http.Abstractions/Volo/Abp/Http/ClientProxyExceptionEventData.cs
  5. 2
      framework/src/Volo.Abp.Http.Client.Dapr/Volo.Abp.Http.Client.Dapr.csproj
  6. 2
      framework/src/Volo.Abp.Http.Client.Dapr/Volo/Abp/Http/Client/Dapr/AbpInvocationHandler.cs
  7. 2
      framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo.Abp.Http.Client.IdentityModel.MauiBlazor.csproj
  8. 2
      framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo/Abp/Http/Client/IdentityModel/MauiBlazor/MauiBlazorAbpAccessTokenProvider.cs
  9. 2
      framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj
  10. 2
      framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo/Abp/Http/Client/IdentityModel/Web/HttpContextAbpAccessTokenProvider.cs
  11. 2
      framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj
  12. 4
      framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo/Abp/Http/Client/IdentityModel/WebAssembly/WebAssemblyAbpAccessTokenProvider.cs
  13. 2
      framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj
  14. 3
      framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/RemoteServiceConfigurationExtensions.cs
  15. 2
      framework/src/Volo.Abp.Http.Client.Web/Volo.Abp.Http.Client.Web.csproj
  16. 18
      framework/src/Volo.Abp.Http.Client.Web/Volo/Abp/Http/Client/Web/Conventions/AbpHttpClientProxyServiceConvention.cs
  17. 2
      framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionHttpClientProxyExtensions.cs
  18. 2
      framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj
  19. 2
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/IAbpAccessTokenProvider.cs
  20. 2
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Authentication/NullAbpAccessTokenProvider.cs
  21. 8
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyApiDescriptionFinder.cs
  22. 26
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs
  23. 21
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyRequestPayloadBuilder.cs
  24. 14
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyUrlBuilder.cs
  25. 6
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/CurrentApiVersionInfo.cs
  26. 2
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/IClientProxyApiDescriptionFinder.cs
  27. 4
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ICurrentApiVersionInfo.cs
  28. 2
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs
  29. 4
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs
  30. 2
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/Proxying/HttpActionParameterHelper.cs
  31. 2
      framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj
  32. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs
  33. 20
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs
  34. 16
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs
  35. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs
  36. 20
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs
  37. 8
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs
  38. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs
  39. 12
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs
  40. 12
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs
  41. 20
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs
  42. 14
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs
  43. 4
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs
  44. 10
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs
  45. 2
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs
  46. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs
  47. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs
  48. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs
  49. 2
      framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj
  50. 4
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/AbpIdentityClientOptions.cs
  51. 2
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelAuthenticationService.cs
  52. 20
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs
  53. 4
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs
  54. 4
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs
  55. 4
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelDiscoveryDocumentCacheItem.cs
  56. 2
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpRequestMessageOptions.cs
  57. 2
      framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelTokenCacheItem.cs

2
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,

2
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())
{

2
framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Http.Abstractions</AssemblyName>
<PackageId>Volo.Abp.Http.Abstractions</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
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; }
}

2
framework/src/Volo.Abp.Http.Client.Dapr/Volo.Abp.Http.Client.Dapr.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<RootNamespace />
</PropertyGroup>

2
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!;
}
}
}

2
framework/src/Volo.Abp.Http.Client.IdentityModel.MauiBlazor/Volo.Abp.Http.Client.IdentityModel.MauiBlazor.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<PackageId>Volo.Abp.Http.Client.IdentityModel.MauiBlazor</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>

2
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<string> GetTokenAsync()
public virtual Task<string?> GetTokenAsync()
{
return Task.FromResult(null as string);
}

2
framework/src/Volo.Abp.Http.Client.IdentityModel.Web/Volo.Abp.Http.Client.IdentityModel.Web.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Http.Client.IdentityModel.Web</AssemblyName>
<PackageId>Volo.Abp.Http.Client.IdentityModel.Web</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
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<string> GetTokenAsync()
public virtual async Task<string?> GetTokenAsync()
{
var httpContext = HttpContextAccessor?.HttpContext;
if (httpContext == null)

2
framework/src/Volo.Abp.Http.Client.IdentityModel.WebAssembly/Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Http.Client.IdentityModel.WebAssembly</AssemblyName>
<PackageId>Volo.Abp.Http.Client.IdentityModel.WebAssembly</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

4
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<string> GetTokenAsync()
public virtual async Task<string?> GetTokenAsync()
{
if (AccessTokenProvider == null)
{

2
framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Http.Client.IdentityModel</AssemblyName>
<PackageId>Volo.Abp.Http.Client.IdentityModel</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

3
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));

2
framework/src/Volo.Abp.Http.Client.Web/Volo.Abp.Http.Client.Web.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Http.Client.Web</AssemblyName>
<PackageId>Volo.Abp.Http.Client.Web</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

18
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<string, string>("area", moduleApiDescription.RootPath));
controller.RouteValues.Add(new KeyValuePair<string, string?>("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<HttpMethodActionConstraint>().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 &&

2
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;

2
framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Http.Client</AssemblyName>
<PackageId>Volo.Abp.Http.Client</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

2
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<string> GetTokenAsync();
Task<string?> GetTokenAsync();
}

2
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<string> GetTokenAsync()
public Task<string?> GetTokenAsync()
{
return Task.FromResult(null as string);
}

8
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<string, ActionApiDescriptionModel> 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()!;
}
}

26
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<TService> : ITransientDependency
{
public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!;
protected IClientProxyApiDescriptionFinder ClientProxyApiDescriptionFinder => LazyServiceProvider.LazyGetRequiredService<IClientProxyApiDescriptionFinder>();
protected ICancellationTokenProvider CancellationTokenProvider => LazyServiceProvider.LazyGetRequiredService<ICancellationTokenProvider>();
@ -42,17 +42,17 @@ public class ClientProxyBase<TService> : ITransientDependency
protected ICurrentApiVersionInfo CurrentApiVersionInfo => LazyServiceProvider.LazyGetRequiredService<ICurrentApiVersionInfo>();
protected ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService<ILocalEventBus>();
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<T> RequestAsync<T>(string methodName, ClientProxyRequestTypeValue arguments = null)
protected virtual async Task<T> RequestAsync<T>(string methodName, ClientProxyRequestTypeValue? arguments = null)
{
return await RequestAsync<T>(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<TService> : 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<TService> : ITransientDependency
if (stringContent.IsNullOrWhiteSpace())
{
return default;
return default!;
}
return JsonSerializer.Deserialize<T>(stringContent);
@ -177,7 +177,7 @@ public class ClientProxyBase<TService> : 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<string> GetUrlWithParametersAsync(ClientProxyRequestContext requestContext, ApiVersionInfo apiVersion)
@ -185,7 +185,7 @@ public class ClientProxyBase<TService> : ITransientDependency
return await ClientProxyUrlBuilder.GenerateUrlWithParametersAsync(requestContext.Action, requestContext.Arguments, apiVersion);
}
protected virtual async Task<HttpContent> GetHttpContentAsync(ClientProxyRequestContext requestContext, ApiVersionInfo apiVersion)
protected virtual async Task<HttpContent?> GetHttpContentAsync(ClientProxyRequestContext requestContext, ApiVersionInfo apiVersion)
{
return await ClientProxyRequestPayloadBuilder.BuildContentAsync(requestContext.Action, requestContext.Arguments, JsonSerializer, apiVersion);
}
@ -199,15 +199,15 @@ public class ClientProxyBase<TService> : 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<string> GetConfiguredApiVersionAsync(ClientProxyRequestContext requestContext)
protected virtual async Task<string?> 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<TService> : 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))

21
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<HttpContent> BuildContentAsync(ActionApiDescriptionModel action, IReadOnlyDictionary<string, object> methodArguments, IJsonSerializer jsonSerializer, ApiVersionInfo apiVersion)
public virtual async Task<HttpContent?> BuildContentAsync(ActionApiDescriptionModel action, IReadOnlyDictionary<string, object> 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<HttpContent> GenerateBodyAsync(ActionApiDescriptionModel action, IReadOnlyDictionary<string, object> methodArguments, IJsonSerializer jsonSerializer)
protected virtual Task<HttpContent?> GenerateBodyAsync(ActionApiDescriptionModel action, IReadOnlyDictionary<string, object> methodArguments, IJsonSerializer jsonSerializer)
{
var parameters = action
.Parameters
@ -63,7 +62,7 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency
if (parameters.Length <= 0)
{
return Task.FromResult<HttpContent>(null);
return Task.FromResult<HttpContent?>(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<HttpContent>(null);
return Task.FromResult<HttpContent?>(null);
}
return Task.FromResult<HttpContent>(new StringContent(jsonSerializer.Serialize(value), Encoding.UTF8, MimeTypes.Application.Json));
return Task.FromResult<HttpContent?>(new StringContent(jsonSerializer.Serialize(value), Encoding.UTF8, MimeTypes.Application.Json));
}
protected virtual async Task<HttpContent> GenerateFormPostDataAsync(ActionApiDescriptionModel action, IReadOnlyDictionary<string, object> methodArguments)
protected virtual async Task<HttpContent?> GenerateFormPostDataAsync(ActionApiDescriptionModel action, IReadOnlyDictionary<string, object> methodArguments)
{
var parameters = action
.Parameters
@ -108,7 +107,7 @@ public class ClientProxyRequestPayloadBuilder : ITransientDependency
{
using (var scope = ServiceScopeFactory.CreateScope())
{
var formDataContents = await (Task<List<KeyValuePair<string, HttpContent>>>)CallObjectToFormDataAsyncMethod
var formDataContents = await (Task<List<KeyValuePair<string, HttpContent>>?>)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);
}
}

14
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<string>)CallObjectToPathAsyncMethod
var path = await (Task<string?>)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<string>)CallObjectToQueryStringAsyncMethod
var queryString = await (Task<string?>)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<string> ConvertValueToStringAsync([CanBeNull] object value)
protected virtual Task<string?> 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());

6
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<ApiVersionInfo> _currentApiVersionInfo = new AsyncLocal<ApiVersionInfo>();
private readonly AsyncLocal<ApiVersionInfo?> _currentApiVersionInfo = new AsyncLocal<ApiVersionInfo?>();
public virtual IDisposable Change(ApiVersionInfo apiVersionInfo)
public virtual IDisposable Change(ApiVersionInfo? apiVersionInfo)
{
var parent = ApiVersionInfo;
_currentApiVersionInfo.Value = apiVersionInfo;

2
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();
}

4
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);
}

2
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<ApplicationApiDescriptionModel>(content, DeserializeOptions);
var result = JsonSerializer.Deserialize<ApplicationApiDescriptionModel>(content, DeserializeOptions)!;
return result;
}

4
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs

@ -66,7 +66,7 @@ public class DynamicHttpProxyInterceptor<TService> : 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<TService> : AbpInterceptor, ITransientD
.MakeGenericType(resultType)
.GetProperty(nameof(Task<object>.Result), BindingFlags.Instance | BindingFlags.Public);
Check.NotNull(resultProperty, nameof(resultProperty));
return resultProperty.GetValue(task);
return resultProperty!.GetValue(task)!;
}
}

2
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<string, object> methodArguments, ParameterApiDescriptionModel apiParameter)
public static object? FindParameterValue(IReadOnlyDictionary<string, object> methodArguments, ParameterApiDescriptionModel apiParameter)
{
var value = methodArguments.GetOrDefault(apiParameter.NameOnMethod);
if (value == null)

2
framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Http</AssemblyName>
<PackageId>Volo.Abp.Http</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

6
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;

20
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<string> SupportedVersions { get; set; }
public IList<string>? SupportedVersions { get; set; }
public IList<MethodParameterApiDescriptionModel> ParametersOnMethod { get; set; }
public IList<MethodParameterApiDescriptionModel> ParametersOnMethod { get; set; } = default!;
public IList<ParameterApiDescriptionModel> Parameters { get; set; }
public IList<ParameterApiDescriptionModel> 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<string> supportedVersions, bool? allowAnonymous = null, string implementFrom = null)
public static ActionApiDescriptionModel Create([NotNull] string uniqueName, [NotNull] MethodInfo method, [NotNull] string url, string? httpMethod, [NotNull] IList<string> supportedVersions, bool? allowAnonymous = null, string? implementFrom = null)
{
Check.NotNull(uniqueName, nameof(uniqueName));
Check.NotNull(method, nameof(method));

16
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)}]";
}
}

6
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<string, ModuleApiDescriptionModel> Modules { get; set; }
public IDictionary<string, ModuleApiDescriptionModel> Modules { get; set; } = default!;
public IDictionary<string, TypeApiDescriptionModel> Types { get; set; }
public IDictionary<string, TypeApiDescriptionModel> 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(); ;

20
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<ControllerInterfaceApiDescriptionModel> Interfaces { get; set; }
public List<ControllerInterfaceApiDescriptionModel> Interfaces { get; set; } = default!;
public Dictionary<string, ActionApiDescriptionModel> Actions { get; set; }
public Dictionary<string, ActionApiDescriptionModel> Actions { get; set; } = default!;
public ControllerApiDescriptionModel()
{
}
public static ControllerApiDescriptionModel Create(string controllerName, string groupName, bool isRemoteService, bool isIntegrationService, string apiVersion, Type type, [CanBeNull] HashSet<Type> ignoredInterfaces = null)
public static ControllerApiDescriptionModel Create(string controllerName, string? groupName, bool isRemoteService, bool isIntegrationService, string? apiVersion, Type type, HashSet<Type>? 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<string, ActionApiDescriptionModel>(),
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
{

8
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
};

6
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<MethodParameterApiDescriptionModel> ParametersOnMethod { get; set; }
public IList<MethodParameterApiDescriptionModel> ParametersOnMethod { get; set; } = default!;
public ReturnValueApiDescriptionModel ReturnValue { get; set; }
public ReturnValueApiDescriptionModel ReturnValue { get; set; } = default!;
public InterfaceMethodApiDescriptionModel()
{

12
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),

12
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs

@ -18,11 +18,11 @@ public class ModuleApiDescriptionModel
/// </summary>
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<string, ControllerApiDescriptionModel> Controllers { get; set; }
public IDictionary<string, ControllerApiDescriptionModel> 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<Type> ignoredInterfaces = null)
public ControllerApiDescriptionModel GetOrAddController(string name, string? groupName, bool isRemoteService, bool isIntegrationService, string? apiVersion, Type type, HashSet<Type>? 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);

20
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
{

14
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)
{

4
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()
{

10
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()
{

2
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<PropertyInfo, string> PropertyNameGenerator { get; set; }
public static Func<PropertyInfo, string?> PropertyNameGenerator { get; set; }
static AbpApiProxyScriptingConfiguration()
{

6
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!

6
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

6
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<string, string> Properties { get; set; }

2
framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj

@ -5,6 +5,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.IdentityModel</AssemblyName>
<PackageId>Volo.Abp.IdentityModel</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

4
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;
}
}

2
framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IIdentityModelAuthenticationService.cs

@ -9,7 +9,7 @@ public interface IIdentityModelAuthenticationService
{
Task<bool> TryAuthenticateAsync(
[NotNull] HttpClient client,
string identityClientName = null);
string? identityClientName = null);
Task<string> GetAccessTokenAsync(
IdentityClientConfiguration configuration);

20
framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfiguration.cs

@ -5,14 +5,14 @@ using IdentityModel;
namespace Volo.Abp.IdentityModel;
public class IdentityClientConfiguration : Dictionary<string, string>
public class IdentityClientConfiguration : Dictionary<string, string?>
{
/// <summary>
/// Possible values: "client_credentials" or "password".
/// Default value: "client_credentials".
/// </summary>
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<string, string>
/// Client Id.
/// </summary>
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<string, string>
/// Client secret (as plain text - without hashed).
/// </summary>
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<string, string>
/// User name.
/// Valid only if <see cref="GrantType"/> is "password".
/// </summary>
public string UserName {
public string? UserName {
get => this.GetOrDefault(nameof(UserName));
set => this[nameof(UserName)] = value;
}
@ -45,7 +45,7 @@ public class IdentityClientConfiguration : Dictionary<string, string>
/// Password of the <see cref="UserName"/>.
/// Valid only if <see cref="GrantType"/> is "password".
/// </summary>
public string UserPassword {
public string? UserPassword {
get => this.GetOrDefault(nameof(UserPassword));
set => this[nameof(UserPassword)] = value;
}
@ -54,7 +54,7 @@ public class IdentityClientConfiguration : Dictionary<string, string>
/// Authority.
/// </summary>
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<string, string>
/// Scope.
/// </summary>
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, string>
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,

4
framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityClientConfigurationDictionary.cs

@ -2,11 +2,11 @@
namespace Volo.Abp.IdentityModel;
public class IdentityClientConfigurationDictionary : Dictionary<string, IdentityClientConfiguration>
public class IdentityClientConfigurationDictionary : Dictionary<string, IdentityClientConfiguration?>
{
public const string DefaultName = "Default";
public IdentityClientConfiguration Default {
public IdentityClientConfiguration? Default {
get => this.GetOrDefault(DefaultName);
set => this[DefaultName] = value;
}

4
framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs

@ -54,7 +54,7 @@ public class IdentityModelAuthenticationService : IIdentityModelAuthenticationSe
public async Task<bool> 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<string> GetAccessTokenOrNullAsync(string identityClientName)
protected virtual async Task<string?> GetAccessTokenOrNullAsync(string? identityClientName)
{
var configuration = ClientOptions.GetClientConfiguration(CurrentTenant, identityClientName);
if (configuration == null)

4
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()
{

2
framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelHttpRequestMessageOptions.cs

@ -5,5 +5,5 @@ namespace Volo.Abp.IdentityModel;
public class IdentityModelHttpRequestMessageOptions
{
public Action<HttpRequestMessage> ConfigureHttpRequestMessage { get; set; }
public Action<HttpRequestMessage>? ConfigureHttpRequestMessage { get; set; }
}

2
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()
{

Loading…
Cancel
Save