diff --git a/framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/Messages/UiMessageEventArgs.cs b/framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/Messages/UiMessageEventArgs.cs index adae13a4c2..45bb66aaac 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/Messages/UiMessageEventArgs.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/Messages/UiMessageEventArgs.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.AspNetCore.Components.Messages; public class UiMessageEventArgs : EventArgs { - public UiMessageEventArgs(UiMessageType messageType, string message, string title, UiMessageOptions options) + public UiMessageEventArgs(UiMessageType messageType, string message, string? title, UiMessageOptions options) { MessageType = messageType; Message = message; @@ -13,7 +13,7 @@ public class UiMessageEventArgs : EventArgs Options = options; } - public UiMessageEventArgs(UiMessageType messageType, string message, string title, UiMessageOptions options, TaskCompletionSource callback) + public UiMessageEventArgs(UiMessageType messageType, string message, string? title, UiMessageOptions options, TaskCompletionSource callback) { MessageType = messageType; Message = message; @@ -26,7 +26,7 @@ public class UiMessageEventArgs : EventArgs public string Message { get; } - public string Title { get; } + public string? Title { get; } public UiMessageOptions Options { get; } diff --git a/framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/Notifications/UiNotificationEventArgs.cs b/framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/Notifications/UiNotificationEventArgs.cs index 554450d025..c12f7a0f06 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/Notifications/UiNotificationEventArgs.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components/Volo/Abp/AspNetCore/Components/Notifications/UiNotificationEventArgs.cs @@ -4,7 +4,7 @@ namespace Volo.Abp.AspNetCore.Components.Notifications; public class UiNotificationEventArgs : EventArgs { - public UiNotificationEventArgs(UiNotificationType notificationType, string message, string title, UiNotificationOptions options) + public UiNotificationEventArgs(UiNotificationType notificationType, string message, string? title, UiNotificationOptions options) { NotificationType = notificationType; Message = message; @@ -16,7 +16,7 @@ public class UiNotificationEventArgs : EventArgs public string Message { get; } - public string Title { get; } + public string? Title { get; } public UiNotificationOptions Options { get; } } diff --git a/framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs b/framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs index a564edf18f..f4697a443a 100644 --- a/framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs +++ b/framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs @@ -22,8 +22,8 @@ public static class AbpAutoMapperExtensibleDtoExtensions (source, destination, extraProps) => { var result = extraProps.IsNullOrEmpty() - ? new Dictionary() - : new Dictionary(extraProps); + ? new Dictionary() + : new Dictionary(extraProps); ExtensibleObjectMapper .MapExtraPropertiesTo( diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index f476ecad89..58867d6e5d 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -174,32 +174,32 @@ public abstract class AbpCrudPageBase< where TCreateViewModel : class, new() where TUpdateViewModel : class, new() { - [Inject] protected TAppService AppService { get; set; } - [Inject] protected IStringLocalizer UiLocalizer { get; set; } - [Inject] public IAbpEnumLocalizer AbpEnumLocalizer { get; set; } + [Inject] protected TAppService AppService { get; set; } = default!; + [Inject] protected IStringLocalizer UiLocalizer { get; set; } = default!; + [Inject] public IAbpEnumLocalizer AbpEnumLocalizer { get; set; } = default!; protected virtual int PageSize { get; } = LimitedResultRequestDto.DefaultMaxResultCount; protected int CurrentPage = 1; - protected string CurrentSorting; + protected string CurrentSorting = default!; protected int? TotalCount; protected TGetListInput GetListInput = new TGetListInput(); protected IReadOnlyList Entities = Array.Empty(); protected TCreateViewModel NewEntity; - protected TKey EditingEntityId; + protected TKey EditingEntityId = default!; protected TUpdateViewModel EditingEntity; - protected Modal CreateModal; - protected Modal EditModal; - protected Validations CreateValidationsRef; - protected Validations EditValidationsRef; + protected Modal? CreateModal; + protected Modal? EditModal; + protected Validations? CreateValidationsRef; + protected Validations? EditValidationsRef; protected List BreadcrumbItems = new List(2); - protected DataGridEntityActionsColumn EntityActionsColumn; + protected DataGridEntityActionsColumn EntityActionsColumn = default!; protected EntityActionDictionary EntityActions { get; set; } protected TableColumnDictionary TableColumns { get; set; } - protected string CreatePolicyName { get; set; } - protected string UpdatePolicyName { get; set; } - protected string DeletePolicyName { get; set; } + protected string? CreatePolicyName { get; set; } + protected string? UpdatePolicyName { get; set; } + protected string? DeletePolicyName { get; set; } public bool HasCreatePermission { get; set; } public bool HasUpdatePermission { get; set; } @@ -360,7 +360,7 @@ public abstract class AbpCrudPageBase< protected virtual Task CloseCreateModalAsync() { NewEntity = new TCreateViewModel(); - return InvokeAsync(CreateModal.Hide); + return InvokeAsync(CreateModal!.Hide); } protected virtual Task ClosingCreateModal(ModalClosingEventArgs eventArgs) @@ -429,7 +429,7 @@ public abstract class AbpCrudPageBase< protected virtual Task CloseEditModalAsync() { - InvokeAsync(EditModal.Hide); + InvokeAsync(EditModal!.Hide); return Task.CompletedTask; } @@ -477,7 +477,7 @@ public abstract class AbpCrudPageBase< NewEntity = new TCreateViewModel(); await GetEntitiesAsync(); - await InvokeAsync(CreateModal.Hide); + await InvokeAsync(CreateModal!.Hide); } protected virtual async Task UpdateEntityAsync() @@ -515,7 +515,7 @@ public abstract class AbpCrudPageBase< { await GetEntitiesAsync(); - await InvokeAsync(EditModal.Hide); + await InvokeAsync(EditModal!.Hide); } protected virtual async Task DeleteEntityAsync(TListViewModel entity) @@ -572,7 +572,7 @@ public abstract class AbpCrudPageBase< /// Does nothing if is null or empty. /// /// A policy name to check - protected virtual async Task CheckPolicyAsync([CanBeNull] string policyName) + protected virtual async Task CheckPolicyAsync(string? policyName) { if (string.IsNullOrEmpty(policyName)) { @@ -633,7 +633,7 @@ public abstract class AbpCrudPageBase< if (propertyInfo.Name.EndsWith("_Text")) { var lookupPropertyName = propertyInfo.Name.RemovePostFix("_Text"); - var lookupPropertyDefinition = properties.SingleOrDefault(t => t.Name == lookupPropertyName); + var lookupPropertyDefinition = properties.SingleOrDefault(t => t.Name == lookupPropertyName)!; yield return new TableColumn { Title = lookupPropertyDefinition.GetLocalizedDisplayName(StringLocalizerFactory), @@ -658,7 +658,7 @@ public abstract class AbpCrudPageBase< if (propertyInfo.Type.IsEnum) { column.ValueConverter = (val) => - AbpEnumLocalizer.GetString(propertyInfo.Type, val.As().ExtraProperties[propertyInfo.Name], new IStringLocalizer[]{ StringLocalizerFactory.CreateDefaultOrNull() }); + AbpEnumLocalizer.GetString(propertyInfo.Type, val.As().ExtraProperties[propertyInfo.Name]!, new IStringLocalizer?[]{ StringLocalizerFactory.CreateDefaultOrNull() }); } yield return column; diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs index de72bdaae2..6631a2236b 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiMessageService.cs @@ -15,7 +15,7 @@ public class BlazoriseUiMessageService : IUiMessageService, IScopedDependency /// /// An event raised after the message is received. Used to notify the message dialog. /// - public event EventHandler MessageReceived; + public event EventHandler? MessageReceived ; private readonly IStringLocalizer localizer; @@ -29,7 +29,7 @@ public class BlazoriseUiMessageService : IUiMessageService, IScopedDependency Logger = NullLogger.Instance; } - public Task Info(string message, string title = null, Action options = null) + public Task Info(string message, string? title = null, Action? options = null) { var uiMessageOptions = CreateDefaultOptions(); options?.Invoke(uiMessageOptions); @@ -39,7 +39,7 @@ public class BlazoriseUiMessageService : IUiMessageService, IScopedDependency return Task.CompletedTask; } - public Task Success(string message, string title = null, Action options = null) + public Task Success(string message, string? title = null, Action? options = null) { var uiMessageOptions = CreateDefaultOptions(); options?.Invoke(uiMessageOptions); @@ -49,7 +49,7 @@ public class BlazoriseUiMessageService : IUiMessageService, IScopedDependency return Task.CompletedTask; } - public Task Warn(string message, string title = null, Action options = null) + public Task Warn(string message, string? title = null, Action? options = null) { var uiMessageOptions = CreateDefaultOptions(); options?.Invoke(uiMessageOptions); @@ -59,7 +59,7 @@ public class BlazoriseUiMessageService : IUiMessageService, IScopedDependency return Task.CompletedTask; } - public Task Error(string message, string title = null, Action options = null) + public Task Error(string message, string? title = null, Action? options = null) { var uiMessageOptions = CreateDefaultOptions(); options?.Invoke(uiMessageOptions); @@ -69,7 +69,7 @@ public class BlazoriseUiMessageService : IUiMessageService, IScopedDependency return Task.CompletedTask; } - public Task Confirm(string message, string title = null, Action options = null) + public Task Confirm(string message, string? title = null, Action? options = null) { var uiMessageOptions = CreateDefaultOptions(); options?.Invoke(uiMessageOptions); diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs index cd993f7f46..f34e34b890 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiNotificationService.cs @@ -11,9 +11,9 @@ public class BlazoriseUiNotificationService : IUiNotificationService, IScopedDep /// /// An event raised after the notification is received. /// - public event EventHandler NotificationReceived; + public event EventHandler? NotificationReceived; - public Task Info(string message, string title = null, Action options = null) + public Task Info(string message, string? title = null, Action? options = null) { var uiNotificationOptions = CreateDefaultOptions(); options?.Invoke(uiNotificationOptions); @@ -23,7 +23,7 @@ public class BlazoriseUiNotificationService : IUiNotificationService, IScopedDep return Task.CompletedTask; } - public Task Success(string message, string title = null, Action options = null) + public Task Success(string message, string? title = null, Action? options = null) { var uiNotificationOptions = CreateDefaultOptions(); options?.Invoke(uiNotificationOptions); @@ -33,7 +33,7 @@ public class BlazoriseUiNotificationService : IUiNotificationService, IScopedDep return Task.CompletedTask; } - public Task Warn(string message, string title = null, Action options = null) + public Task Warn(string message, string? title = null, Action? options = null) { var uiNotificationOptions = CreateDefaultOptions(); options?.Invoke(uiNotificationOptions); @@ -43,7 +43,7 @@ public class BlazoriseUiNotificationService : IUiNotificationService, IScopedDep return Task.CompletedTask; } - public Task Error(string message, string title = null, Action options = null) + public Task Error(string message, string? title = null, Action? options = null) { var uiNotificationOptions = CreateDefaultOptions(); options?.Invoke(uiNotificationOptions); diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs index a0516d8b4e..a3cd7372a6 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs @@ -44,7 +44,7 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions typeof(PhoneAttribute) }; - public static string GetDateEditInputFormatOrNull(this IBasicObjectExtensionPropertyInfo property) + public static string? GetDateEditInputFormatOrNull(this IBasicObjectExtensionPropertyInfo property) { if (property.IsDate()) { @@ -59,7 +59,7 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions return null; } - public static string GetTextInputValueOrNull(this IBasicObjectExtensionPropertyInfo property, object value) + public static string? GetTextInputValueOrNull(this IBasicObjectExtensionPropertyInfo property, object? value) { if (value == null) { @@ -74,7 +74,7 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions return value.ToString(); } - public static T GetInputValueOrDefault(this IBasicObjectExtensionPropertyInfo property, object value) + public static T? GetInputValueOrDefault(this IBasicObjectExtensionPropertyInfo property, object? value) { if (value == null) { @@ -204,7 +204,7 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions ?? typeof(TextExtensionProperty<,>); //default } - private static Type GetInputTypeFromAttributeOrNull(Attribute attribute) + private static Type? GetInputTypeFromAttributeOrNull(Attribute attribute) { var hasTextEditSupport = TextEditSupportedAttributeTypes.Any(t => t == attribute.GetType()); @@ -238,7 +238,7 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions return null; } - private static Type GetInputTypeFromTypeOrNull(Type type) + private static Type? GetInputTypeFromTypeOrNull(Type type) { if (type == typeof(bool)) { diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiPageProgressService.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiPageProgressService.cs index d2d82ad8a5..a49fc8aecc 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiPageProgressService.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiPageProgressService.cs @@ -12,9 +12,9 @@ public class BlazoriseUiPageProgressService : IUiPageProgressService, /// /// An event raised after the notification is received. /// - public event EventHandler ProgressChanged; + public event EventHandler? ProgressChanged; - public Task Go(int? percentage, Action options = null) + public Task Go(int? percentage, Action? options = null) { var uiPageProgressOptions = CreateDefaultOptions(); options?.Invoke(uiPageProgressOptions); diff --git a/framework/src/Volo.Abp.BlazoriseUI/BreadcrumbItem.cs b/framework/src/Volo.Abp.BlazoriseUI/BreadcrumbItem.cs index 3ccb68698f..7f02b02b85 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/BreadcrumbItem.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/BreadcrumbItem.cs @@ -6,11 +6,11 @@ public class BreadcrumbItem { public string Text { get; set; } - public object Icon { get; set; } + public object? Icon { get; set; } - public string Url { get; set; } + public string? Url { get; set; } - public BreadcrumbItem(string text, string url = null, object icon = null) + public BreadcrumbItem(string text, string? url = null, object? icon = null) { Text = text; Url = url; diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor index cbdfc25c99..522140811e 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor @@ -121,7 +121,7 @@ @{ var entity = context as IHasExtraProperties; var propertyName = ExtensionPropertiesRegex.Match(column.Data).Groups[1].Value; - var propertyValue = entity.GetProperty(propertyName); + var propertyValue = entity?.GetProperty(propertyName); if (propertyValue != null && propertyValue.GetType() == typeof(bool)) { if ((bool) propertyValue) diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs index f9baf631f5..4642afcadd 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor.cs @@ -18,7 +18,7 @@ public partial class AbpExtensibleDataGrid : ComponentBase protected Regex ExtensionPropertiesRegex = new Regex(@"ExtraProperties\[(.*?)\]"); - [Parameter] public IEnumerable Data { get; set; } + [Parameter] public IEnumerable Data { get; set; } = default!; [Parameter] public EventCallback> ReadData { get; set; } @@ -28,16 +28,16 @@ public partial class AbpExtensibleDataGrid : ComponentBase [Parameter] public int PageSize { get; set; } - [Parameter] public IEnumerable Columns { get; set; } + [Parameter] public IEnumerable Columns { get; set; } = default!; [Parameter] public int CurrentPage { get; set; } = 1; - [Parameter] public string Class { get; set; } + [Parameter] public string? Class { get; set; } [Parameter] public bool Responsive { get; set; } [Inject] - public IStringLocalizerFactory StringLocalizerFactory { get; set; } + public IStringLocalizerFactory StringLocalizerFactory { get; set; } = default!; protected virtual RenderFragment RenderCustomTableColumnComponent(Type type, object data) { @@ -51,10 +51,10 @@ public partial class AbpExtensibleDataGrid : ComponentBase protected virtual string GetConvertedFieldValue(TItem item, TableColumn columnDefinition) { - var convertedValue = columnDefinition.ValueConverter.Invoke(item); + var convertedValue = columnDefinition.ValueConverter!.Invoke(item!); if (!columnDefinition.DisplayFormat.IsNullOrEmpty()) { - return string.Format(columnDefinition.DisplayFormatProvider, columnDefinition.DisplayFormat, + return string.Format(columnDefinition.DisplayFormatProvider, columnDefinition.DisplayFormat!, convertedValue); } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/AlertWrapper.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/AlertWrapper.cs index ba2024cecb..04b9f18a48 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/AlertWrapper.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/AlertWrapper.cs @@ -4,6 +4,6 @@ namespace Volo.Abp.BlazoriseUI.Components; internal class AlertWrapper { - public AlertMessage AlertMessage { get; set; } + public AlertMessage AlertMessage { get; set; } = default!; public bool IsVisible { get; set; } } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.razor.cs index 3d52012efd..9a39acd4fc 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/DataGridEntityActionsColumn.razor.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.BlazoriseUI.Components; public partial class DataGridEntityActionsColumn : DataGridColumn { [Inject] - public IStringLocalizer UiLocalizer { get; set; } + public IStringLocalizer UiLocalizer { get; set; } = default!; protected override async Task OnInitializedAsync() { diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs index a38d915ff1..ef487bafcb 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityAction.razor.cs @@ -18,7 +18,7 @@ public partial class EntityAction : ComponentBase internal bool HasPermission { get; set; } = true; [Parameter] - public string Text { get; set; } + public string Text { get; set; } = default!; [Parameter] public bool Primary { get; set; } @@ -28,25 +28,25 @@ public partial class EntityAction : ComponentBase [Parameter] [Obsolete("Use Visible to hide actions based on permissions. Check the permission yourself. It is more performant. This option might be removed in future versions.")] - public string RequiredPolicy { get; set; } + public string? RequiredPolicy { get; set; } [Parameter] - public Color Color { get; set; } + public Color? Color { get; set; } [Parameter] - public Func ConfirmationMessage { get; set; } + public Func? ConfirmationMessage { get; set; } [Parameter] - public string Icon { get; set; } + public string? Icon { get; set; } [CascadingParameter] - public EntityActions ParentActions { get; set; } + public EntityActions ParentActions { get; set; } = default!; [Inject] - protected IAuthorizationService AuthorizationService { get; set; } + protected IAuthorizationService AuthorizationService { get; set; } = default!; [Inject] - protected IUiMessageService UiMessageService { get; set; } + protected IUiMessageService UiMessageService { get; set; } = default!; protected async override Task OnInitializedAsync() { @@ -55,7 +55,7 @@ public partial class EntityAction : ComponentBase if (!RequiredPolicy.IsNullOrEmpty()) { - HasPermission = await AuthorizationService.IsGrantedAsync(RequiredPolicy); + HasPermission = await AuthorizationService.IsGrantedAsync(RequiredPolicy!); } ParentActions.AddAction(this); } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor index b362358d70..844dea4950 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/EntityActions.razor @@ -6,7 +6,7 @@ @if ( HasPrimaryAction ) {