diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj index 07ed436526..6874bf6b9a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.AspNetCore.Serilog Volo.Abp.AspNetCore.Serilog $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo.Abp.AspNetCore.SignalR.csproj b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo.Abp.AspNetCore.SignalR.csproj index 8d427a5f21..24796d8e35 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo.Abp.AspNetCore.SignalR.csproj +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo.Abp.AspNetCore.SignalR.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.AspNetCore.SignalR Volo.Abp.AspNetCore.SignalR $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpAspNetCoreSignalRModule.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpAspNetCoreSignalRModule.cs index 13400a7ff9..d0a9aa682d 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpAspNetCoreSignalRModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpAspNetCoreSignalRModule.cs @@ -23,7 +23,7 @@ public class AbpAspNetCoreSignalRModule : AbpModule { private static readonly MethodInfo MapHubGenericMethodInfo = typeof(AbpAspNetCoreSignalRModule) - .GetMethod("MapHub", BindingFlags.Static | BindingFlags.NonPublic); + .GetMethod("MapHub", BindingFlags.Static | BindingFlags.NonPublic)!; public override void PreConfigureServices(ServiceConfigurationContext context) { diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs index 7667b80190..d97fb72421 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs @@ -14,24 +14,24 @@ namespace Volo.Abp.AspNetCore.SignalR; public abstract class AbpHub : Hub { - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!; [Obsolete("Use LazyServiceProvider instead.")] - public IServiceProvider ServiceProvider { get; set; } + public IServiceProvider ServiceProvider { get; set; } = default!; - protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetService(); + protected ILoggerFactory? LoggerFactory => LazyServiceProvider.LazyGetService(); - protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName!) ?? NullLogger.Instance); - protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetService(); + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetService()!; - protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetService(); + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetService()!; - protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetService(); + protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetService()!; - protected IClock Clock => LazyServiceProvider.LazyGetService(); + protected IClock Clock => LazyServiceProvider.LazyGetService()!; - protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetService(); + protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetService()!; protected IStringLocalizer L { get { @@ -43,16 +43,16 @@ public abstract class AbpHub : Hub return _localizer; } } - private IStringLocalizer _localizer; + private IStringLocalizer? _localizer; - protected Type LocalizationResource { + protected Type? LocalizationResource { get => _localizationResource; set { _localizationResource = value; _localizer = null; } } - private Type _localizationResource = typeof(DefaultResource); + private Type? _localizationResource = typeof(DefaultResource); protected virtual IStringLocalizer CreateLocalizer() { @@ -74,23 +74,23 @@ public abstract class AbpHub : Hub public abstract class AbpHub : Hub where T : class { - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!; - public IServiceProvider ServiceProvider { get; set; } + public IServiceProvider ServiceProvider { get; set; } = default!; - protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetService(); + protected ILoggerFactory? LoggerFactory => LazyServiceProvider.LazyGetService(); - protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName!) ?? NullLogger.Instance); - protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetService(); + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetService()!; - protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetService(); + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetService()!; - protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetService(); + protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetService()!; - protected IClock Clock => LazyServiceProvider.LazyGetService(); + protected IClock Clock => LazyServiceProvider.LazyGetService()!; - protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetService(); + protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetService()!; protected IStringLocalizer L { get { @@ -102,16 +102,16 @@ public abstract class AbpHub : Hub return _localizer; } } - private IStringLocalizer _localizer; + private IStringLocalizer? _localizer; - protected Type LocalizationResource { + protected Type? LocalizationResource { get => _localizationResource; set { _localizationResource = value; _localizer = null; } } - private Type _localizationResource = typeof(DefaultResource); + private Type? _localizationResource = typeof(DefaultResource); protected virtual IStringLocalizer CreateLocalizer() { diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHubContext.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHubContext.cs index 8c6b53950d..276ddb62d2 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHubContext.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHubContext.cs @@ -13,9 +13,9 @@ public class AbpHubContext public MethodInfo HubMethod { get; } - public IReadOnlyList HubMethodArguments { get; } + public IReadOnlyList HubMethodArguments { get; } - public AbpHubContext(IServiceProvider serviceProvider, Hub hub, MethodInfo hubMethod, IReadOnlyList hubMethodArguments) + public AbpHubContext(IServiceProvider serviceProvider, Hub hub, MethodInfo hubMethod, IReadOnlyList hubMethodArguments) { ServiceProvider = serviceProvider; Hub = hub; diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHubContextAccessorHubFilter.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHubContextAccessorHubFilter.cs index d88a831685..da774bc13c 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHubContextAccessorHubFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHubContextAccessorHubFilter.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.AspNetCore.SignalR; public class AbpHubContextAccessorHubFilter : IHubFilter { - public virtual async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) + public virtual async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) { var hubContextAccessor = invocationContext.ServiceProvider.GetRequiredService(); using (hubContextAccessor.Change(new AbpHubContext( diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpSignalRUserIdProvider.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpSignalRUserIdProvider.cs index 99ce721375..896f51ab25 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpSignalRUserIdProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpSignalRUserIdProvider.cs @@ -17,7 +17,7 @@ public class AbpSignalRUserIdProvider : IUserIdProvider, ITransientDependency _currentUser = currentUser; } - public virtual string GetUserId(HubConnectionContext connection) + public virtual string? GetUserId(HubConnectionContext connection) { using (_currentPrincipalAccessor.Change(connection.User)) { diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Auditing/AbpAuditHubFilter.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Auditing/AbpAuditHubFilter.cs index e76f415f18..7d3c21f067 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Auditing/AbpAuditHubFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Auditing/AbpAuditHubFilter.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.AspNetCore.SignalR.Auditing; public class AbpAuditHubFilter : IHubFilter { - public virtual async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) + public virtual async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) { var options = invocationContext.ServiceProvider.GetRequiredService>().Value; if (!options.IsEnabled) @@ -27,7 +27,7 @@ public class AbpAuditHubFilter : IHubFilter using (var saveHandle = auditingManager.BeginScope()) { Debug.Assert(auditingManager.Current != null); - object result; + object? result; try { result = await next(invocationContext); diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Authentication/AbpAuthenticationHubFilter.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Authentication/AbpAuthenticationHubFilter.cs index 0a509e74ae..ab79521159 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Authentication/AbpAuthenticationHubFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Authentication/AbpAuthenticationHubFilter.cs @@ -8,10 +8,10 @@ namespace Volo.Abp.AspNetCore.SignalR.Authentication; public class AbpAuthenticationHubFilter : IHubFilter { - public virtual async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) + public virtual async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) { var currentPrincipalAccessor = invocationContext.ServiceProvider.GetRequiredService(); - using (currentPrincipalAccessor.Change(invocationContext.Context.User)) + using (currentPrincipalAccessor.Change(invocationContext.Context.User!)) { return await next(invocationContext); } @@ -20,16 +20,16 @@ public class AbpAuthenticationHubFilter : IHubFilter public virtual async Task OnConnectedAsync(HubLifetimeContext context, Func next) { var currentPrincipalAccessor = context.ServiceProvider.GetRequiredService(); - using (currentPrincipalAccessor.Change(context.Context.User)) + using (currentPrincipalAccessor.Change(context.Context.User!)) { await next(context); } } - public virtual async Task OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func next) + public virtual async Task OnDisconnectedAsync(HubLifetimeContext context, Exception? exception, Func next) { var currentPrincipalAccessor = context.ServiceProvider.GetRequiredService(); - using (currentPrincipalAccessor.Change(context.Context.User)) + using (currentPrincipalAccessor.Change(context.Context.User!)) { await next(context, exception); } diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/DefaultAbpHubContextAccessor.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/DefaultAbpHubContextAccessor.cs index c1473b0569..76099d5feb 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/DefaultAbpHubContextAccessor.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/DefaultAbpHubContextAccessor.cs @@ -6,7 +6,7 @@ namespace Volo.Abp.AspNetCore.SignalR; public class DefaultAbpHubContextAccessor : IAbpHubContextAccessor, ISingletonDependency { - public AbpHubContext Context => _currentHubContext.Value; + public AbpHubContext Context => _currentHubContext.Value!; private readonly AsyncLocal _currentHubContext = new AsyncLocal(); diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/HubConfig.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/HubConfig.cs index 2263dcb7bc..514f6614b0 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/HubConfig.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/HubConfig.cs @@ -20,7 +20,7 @@ public class HubConfig public HubConfig( [NotNull] Type hubType, [NotNull] string routePattern, - [CanBeNull] Action configureAction = null) + Action? configureAction = null) { HubType = Check.NotNull(hubType, nameof(hubType)); RoutePattern = Check.NotNullOrWhiteSpace(routePattern, nameof(routePattern)); diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/HubConfigList.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/HubConfigList.cs index fca0f2b5a4..158a97d8c4 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/HubConfigList.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/HubConfigList.cs @@ -6,12 +6,12 @@ namespace Volo.Abp.AspNetCore.SignalR; public class HubConfigList : List { - public void AddOrUpdate(Action configAction = null) + public void AddOrUpdate(Action? configAction = null) { AddOrUpdate(typeof(THub)); } - public void AddOrUpdate(Type hubType, Action configAction = null) + public void AddOrUpdate(Type hubType, Action? configAction = null) { var hubConfig = this.GetOrAdd( c => c.HubType == hubType, diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj index 07e3a08920..a6f6a55f39 100644 --- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.AspNetCore.TestBase Volo.Abp.AspNetCore.TestBase $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs index aa3ca0621f..8892623364 100644 --- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/AbpAspNetCoreAsyncIntegratedTestBase.cs @@ -16,20 +16,20 @@ namespace Volo.Abp.AspNetCore.TestBase; public class AbpAspNetCoreAsyncIntegratedTestBase where TModule : IAbpModule { - protected WebApplication WebApplication { get; set; } + protected WebApplication WebApplication { get; set; } = default!; - protected TestServer Server { get; set; } + protected TestServer Server { get; set; } = default!; - protected HttpClient Client { get; set; } + protected HttpClient Client { get; set; } = default!; - protected IServiceProvider ServiceProvider { get; set; } + protected IServiceProvider ServiceProvider { get; set; } = default!; - protected virtual T GetService() + protected virtual T? GetService() { return ServiceProvider.GetService(); } - protected virtual T GetRequiredService() + protected virtual T GetRequiredService() where T : notnull { return ServiceProvider.GetRequiredService(); } diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/TestServerAccessor.cs b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/TestServerAccessor.cs index dbf2db4495..d7e37f1575 100644 --- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/TestServerAccessor.cs +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/TestServerAccessor.cs @@ -5,5 +5,5 @@ namespace Volo.Abp.AspNetCore.TestBase; public class TestServerAccessor : ITestServerAccessor, ISingletonDependency { - public TestServer Server { get; set; } + public TestServer Server { get; set; } = default!; }