Skip to content

Commit bf31882

Browse files
authored
Merge pull request #418 from neozhu/fixcompilewarning
clean compile warning
2 parents ed48f65 + ef836b6 commit bf31882

35 files changed

+132
-194
lines changed

src/Application/Features/Documents/Commands/AddEdit/AddEditDocumentCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private class Mapping : Profile
3838
{
3939
public Mapping()
4040
{
41-
CreateMap<AddEditDocumentCommand, DocumentDto>().ReverseMap();
41+
CreateMap<AddEditDocumentCommand, DocumentDto>(MemberList.None).ReverseMap();
4242
}
4343
}
4444
}

src/Application/Features/Documents/DTOs/DocumentDto.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public Mapping()
3838
CreateMap<Document, DocumentDto>(MemberList.None)
3939
.ForMember(x => x.TenantName, s => s.MapFrom(y => y.Tenant!.Name));
4040
CreateMap<DocumentDto, Document>(MemberList.None)
41-
.ForMember(x => x.Tenant, s => s.Ignore());
41+
.ForMember(x => x.Tenant, s => s.Ignore())
42+
.ForMember(x=>x.Owner, s=>s.Ignore());
4243
}
4344
}
4445
}

src/Application/Features/Documents/Queries/PaginationQuery/DocumentsWithPaginationQuery.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace CleanArchitecture.Blazor.Application.Features.Documents.Queries.Pagina
99
public class DocumentsWithPaginationQuery : PaginationFilter, ICacheableRequest<PaginatedData<DocumentDto>>
1010
{
1111
public DocumentListView ListView { get; set; } = DocumentListView.All;
12-
public UserProfile? CurrentUser { get; set; }
12+
public required UserProfile CurrentUser { get; set; }
1313
public string CacheKey => DocumentCacheKey.GetPaginationCacheKey($"{this}");
1414
public MemoryCacheEntryOptions? Options => DocumentCacheKey.MemoryCacheEntryOptions;
1515

src/Application/Features/KeyValues/DTOs/KeyValueDto.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private class Mapping : Profile
2424
{
2525
public Mapping()
2626
{
27-
CreateMap<KeyValue, KeyValueDto>().ReverseMap();
27+
CreateMap<KeyValue, KeyValueDto>(MemberList.None).ReverseMap();
2828
}
2929
}
3030
}

src/Application/Features/Loggers/DTOs/LogDto.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ public class LogDto
1515

1616
[Description("Level")] public string Level { get; set; } = default!;
1717

18-
public bool ShowDetails { get; set; }
19-
2018
[Description("Timestamp")] public DateTime TimeStamp { get; set; } = DateTime.UtcNow;
2119

2220
[Description("Exception")] public string? Exception { get; set; }

src/Blazor.Server.UI/Components/Common/MudEnumSelect.razor

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
bool _isFlagsEnum;
1111
private static bool IsNullableEnum => Nullable.GetUnderlyingType(typeof(TEnum))?.IsEnum ?? false;
1212

13-
private static IList<TEnum> EnumValueList => EnumOrUnderlyingType.GetEnumValues().Cast<TEnum>().ToList();
13+
private static IList<TEnum> EnumValueList => EnumOrUnderlyingType!.GetEnumValues().Cast<TEnum>().ToList();
1414

15-
private static Type EnumOrUnderlyingType => IsNullableEnum ? Nullable.GetUnderlyingType(typeof(TEnum)) : typeof(TEnum);
15+
private static Type? EnumOrUnderlyingType => IsNullableEnum ? Nullable.GetUnderlyingType(typeof(TEnum)) : typeof(TEnum);
1616

1717
protected override void OnInitialized()
1818
{
1919
Dense = true;
2020
TransformOrigin = Origin.TopLeft;
2121
AnchorOrigin = Origin.BottomLeft;
22-
_isFlagsEnum = EnumOrUnderlyingType.GetCustomAttribute<FlagsAttribute>() != null;
22+
_isFlagsEnum = EnumOrUnderlyingType!.GetCustomAttribute<FlagsAttribute>() != null;
2323
MultiSelection = _isFlagsEnum;
2424
base.OnInitialized();
2525
}
@@ -67,13 +67,13 @@
6767
}
6868
private T SetFlag<T>(T flag, bool set)
6969
{
70-
Enum value = Value as Enum;
70+
Enum? value = Value as Enum;
7171

72-
Type underlyingType = Enum.GetUnderlyingType(EnumOrUnderlyingType);
72+
Type underlyingType = Enum.GetUnderlyingType(EnumOrUnderlyingType!);
7373

7474
// note: AsInt mean: math integer vs enum (not the c# int type)
75-
dynamic valueAsInt = Convert.ChangeType(value, underlyingType);
76-
dynamic flagAsInt = Convert.ChangeType(flag, underlyingType);
75+
dynamic valueAsInt = Convert.ChangeType(value!, underlyingType);
76+
dynamic flagAsInt = Convert.ChangeType(flag!, underlyingType);
7777
if (set)
7878
valueAsInt |= flagAsInt;
7979
else

src/Blazor.Server.UI/Components/Common/MultiTenantAutocomplete.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected override void Dispose(bool disposing)
2626
public override Task SetParametersAsync(ParameterView parameters)
2727
{
2828
SearchFuncWithCancel = SearchKeyValues;
29-
base.ToStringFunc = ToStringFunc;
29+
ToStringFunc = ToTenantNameStringFunc;
3030
Clearable = true;
3131
Dense = true;
3232
ResetValueOnEmptyText = true;
@@ -46,7 +46,7 @@ private Task<IEnumerable<string>> SearchKeyValues(string value, CancellationToke
4646
).OrderBy(x => x.Name).Select(x=>x.Id).ToList());
4747

4848
}
49-
private string ToStringFunc(string val)
49+
string ToTenantNameStringFunc(string val)
5050
{
5151
return TenantsService.DataSource.Where(x => x.Id == val).Select(x => x.Name).FirstOrDefault()??"";
5252
}

src/Blazor.Server.UI/Components/Shared/LandingSection.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919

2020

2121
@code {
22-
[Parameter] public RenderFragment Stripes { get; set; }
23-
[Parameter] public RenderFragment ChildContent { get; set; }
22+
[Parameter] public RenderFragment Stripes { get; set; } = null!;
23+
[Parameter] public RenderFragment ChildContent { get; set; } = null!;
2424
[Parameter] public bool Straight { get; set; }
2525
[Parameter] public bool StraightEnd { get; set; }
26-
[Parameter] public string SectionClass { get; set; }
27-
[Parameter] public string BackgroundClass { get; set; }
28-
[Parameter] public string Class { get; set; }
26+
[Parameter] public string SectionClass { get; set; } = null!;
27+
[Parameter] public string BackgroundClass { get; set; } = null!;
28+
[Parameter] public string Class { get; set; } = null!;
2929

3030
protected string SectionClassnames =>
3131
new CssBuilder("mud-landingpage-section")

src/Blazor.Server.UI/Components/Shared/UserProfileStateComponent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected override async Task OnInitializedAsync()
2323
var state = await AuthState;
2424
if (state?.User?.Identity?.IsAuthenticated ?? false)
2525
{
26-
var userDto = await IdentityService.GetApplicationUserDto(state.User.GetUserId());
26+
var userDto = await IdentityService.GetApplicationUserDto(state.User.GetUserId()!);
2727
await SetProfile(userDto);
2828
}
2929

@@ -35,7 +35,7 @@ private void _authenticationStateProvider_AuthenticationStateChanged(Task<Authen
3535
var state = await authenticationState;
3636
if (state.User.Identity != null && state.User.Identity.IsAuthenticated)
3737
{
38-
var userDto = await IdentityService.GetApplicationUserDto(state.User.GetUserId());
38+
var userDto = await IdentityService.GetApplicationUserDto(state.User.GetUserId()!);
3939
await SetProfile(userDto);
4040
}
4141
});

src/Blazor.Server.UI/EndPoints/AuthController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public async Task<IActionResult> ExternalLogin(string provider, string userName,
9898
public async Task<IActionResult> Logout()
9999
{
100100
var userId = _signInManager.Context.User.GetUserId();
101-
var identityUser = await _userManager.FindByIdAsync(userId) ?? throw new NotFoundException($"Application user not found.");
101+
var identityUser = await _userManager.FindByIdAsync(userId!) ?? throw new NotFoundException($"Application user not found.");
102102
identityUser.IsLive = false;
103103
await _userManager.UpdateAsync(identityUser);
104104
_logger.LogInformation("{@UserName} logout successful", identityUser.UserName);

0 commit comments

Comments
 (0)