Skip to content

Commit

Permalink
Merge pull request #711 from mixcore/features/apply-ms-aspire
Browse files Browse the repository at this point in the history
Apply microsoft Aspire
  • Loading branch information
nhathoang989 authored Dec 2, 2023
2 parents 519df1f + d86a119 commit c03beae
Show file tree
Hide file tree
Showing 51 changed files with 1,594 additions and 644 deletions.
56 changes: 35 additions & 21 deletions src/Mixcore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "applications", "application
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.library", "platform\mix.library\mix.library.csproj", "{5CC5900C-50FE-4D78-9E4F-7CE267355622}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mixcore", "applications\Mixcore\mixcore.csproj", "{928B382F-48A0-4639-9EC0-0C9BE980C5C6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.common", "modules\mix.common\mix.common.csproj", "{E6801B38-0264-456C-B8E6-A73262B6CBA7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.database", "platform\mix.database\mix.database.csproj", "{3716FB3C-CDC3-45E7-9809-CF7F2DD30388}"
Expand All @@ -23,8 +21,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.shared", "platform\mix.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.account", "modules\mix.account\mix.account.csproj", "{19560515-92A4-4955-BDD9-E1CDA7E8A3BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.portal", "modules\mix.portal\mix.portal.csproj", "{C56B8C71-AEFB-4B4C-9545-03F6A646A998}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.signalr", "platform\mix.signalr\mix.signalr.csproj", "{8401BAD4-7658-4357-859C-19F40E731848}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.identity", "platform\mix.identity\mix.identity.csproj", "{681C6E43-9F8E-4A9B-AD03-12702CF47720}"
Expand Down Expand Up @@ -87,8 +83,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.services.graphql", "ser
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.mixdb.event", "platform\core\mix.mixdb.event\mix.mixdb.event.csproj", "{9508136B-0879-4BF2-B694-3B6242715BE7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mixcore.gateway", "applications\mixcore.gateway\mixcore.gateway.csproj", "{B57EEC99-85CF-4C4E-BB10-929CCD1D3723}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_0", "level_0", "{147A1144-45E8-448A-9FD7-511C999E5727}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "level_1", "level_1", "{0027B7D2-664D-4872-AE99-BA2A2BCA6B2E}"
Expand All @@ -115,6 +109,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.log", "modules\mix.log\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.auth", "platform\mix.auth\mix.auth.csproj", "{67C7637A-1E86-49C0-8BBB-F91260F9058F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mixcore", "applications\mixcore\mixcore.csproj", "{BEFA0F34-2594-4E77-88A9-4DF2B535343A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mixcore.host.aspire.AppHost", "applications\mixcore.host.aspire\mixcore.host.aspire.AppHost\mixcore.host.aspire.AppHost.csproj", "{803BBEFE-A5AF-4C43-87FC-DA9132F18498}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mixcore.host.aspire.ServiceDefaults", "applications\mixcore.host.aspire\mixcore.host.aspire.ServiceDefaults\mixcore.host.aspire.ServiceDefaults.csproj", "{3BADD396-E830-468B-B2D8-A52FD5E6C6BD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mixcore.gateway", "applications\mixcore.gateway\mixcore.gateway.csproj", "{5FA252B6-6FDA-451E-BE5E-F6D82EDE9AB1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.portal", "modules\mix.portal\mix.portal.csproj", "{F5D4C70F-DD2E-4EC9-A191-56A717B1B5EE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -125,10 +129,6 @@ Global
{5CC5900C-50FE-4D78-9E4F-7CE267355622}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CC5900C-50FE-4D78-9E4F-7CE267355622}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CC5900C-50FE-4D78-9E4F-7CE267355622}.Release|Any CPU.Build.0 = Release|Any CPU
{928B382F-48A0-4639-9EC0-0C9BE980C5C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{928B382F-48A0-4639-9EC0-0C9BE980C5C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{928B382F-48A0-4639-9EC0-0C9BE980C5C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{928B382F-48A0-4639-9EC0-0C9BE980C5C6}.Release|Any CPU.Build.0 = Release|Any CPU
{E6801B38-0264-456C-B8E6-A73262B6CBA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6801B38-0264-456C-B8E6-A73262B6CBA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6801B38-0264-456C-B8E6-A73262B6CBA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -145,10 +145,6 @@ Global
{19560515-92A4-4955-BDD9-E1CDA7E8A3BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19560515-92A4-4955-BDD9-E1CDA7E8A3BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19560515-92A4-4955-BDD9-E1CDA7E8A3BC}.Release|Any CPU.Build.0 = Release|Any CPU
{C56B8C71-AEFB-4B4C-9545-03F6A646A998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C56B8C71-AEFB-4B4C-9545-03F6A646A998}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C56B8C71-AEFB-4B4C-9545-03F6A646A998}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C56B8C71-AEFB-4B4C-9545-03F6A646A998}.Release|Any CPU.Build.0 = Release|Any CPU
{8401BAD4-7658-4357-859C-19F40E731848}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8401BAD4-7658-4357-859C-19F40E731848}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8401BAD4-7658-4357-859C-19F40E731848}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -249,10 +245,6 @@ Global
{9508136B-0879-4BF2-B694-3B6242715BE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9508136B-0879-4BF2-B694-3B6242715BE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9508136B-0879-4BF2-B694-3B6242715BE7}.Release|Any CPU.Build.0 = Release|Any CPU
{B57EEC99-85CF-4C4E-BB10-929CCD1D3723}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B57EEC99-85CF-4C4E-BB10-929CCD1D3723}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B57EEC99-85CF-4C4E-BB10-929CCD1D3723}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B57EEC99-85CF-4C4E-BB10-929CCD1D3723}.Release|Any CPU.Build.0 = Release|Any CPU
{BC6B8583-4F0F-45AD-BF71-1D998AA65869}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC6B8583-4F0F-45AD-BF71-1D998AA65869}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC6B8583-4F0F-45AD-BF71-1D998AA65869}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -265,6 +257,26 @@ Global
{67C7637A-1E86-49C0-8BBB-F91260F9058F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67C7637A-1E86-49C0-8BBB-F91260F9058F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67C7637A-1E86-49C0-8BBB-F91260F9058F}.Release|Any CPU.Build.0 = Release|Any CPU
{BEFA0F34-2594-4E77-88A9-4DF2B535343A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEFA0F34-2594-4E77-88A9-4DF2B535343A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEFA0F34-2594-4E77-88A9-4DF2B535343A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEFA0F34-2594-4E77-88A9-4DF2B535343A}.Release|Any CPU.Build.0 = Release|Any CPU
{803BBEFE-A5AF-4C43-87FC-DA9132F18498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{803BBEFE-A5AF-4C43-87FC-DA9132F18498}.Debug|Any CPU.Build.0 = Debug|Any CPU
{803BBEFE-A5AF-4C43-87FC-DA9132F18498}.Release|Any CPU.ActiveCfg = Release|Any CPU
{803BBEFE-A5AF-4C43-87FC-DA9132F18498}.Release|Any CPU.Build.0 = Release|Any CPU
{3BADD396-E830-468B-B2D8-A52FD5E6C6BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BADD396-E830-468B-B2D8-A52FD5E6C6BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BADD396-E830-468B-B2D8-A52FD5E6C6BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BADD396-E830-468B-B2D8-A52FD5E6C6BD}.Release|Any CPU.Build.0 = Release|Any CPU
{5FA252B6-6FDA-451E-BE5E-F6D82EDE9AB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FA252B6-6FDA-451E-BE5E-F6D82EDE9AB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FA252B6-6FDA-451E-BE5E-F6D82EDE9AB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FA252B6-6FDA-451E-BE5E-F6D82EDE9AB1}.Release|Any CPU.Build.0 = Release|Any CPU
{F5D4C70F-DD2E-4EC9-A191-56A717B1B5EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F5D4C70F-DD2E-4EC9-A191-56A717B1B5EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5D4C70F-DD2E-4EC9-A191-56A717B1B5EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5D4C70F-DD2E-4EC9-A191-56A717B1B5EE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -274,12 +286,10 @@ Global
{5B29B975-B0AC-46B3-8398-4C8A22EAE355} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
{4E880812-C336-4EB2-9FED-2E437957F50A} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
{5CC5900C-50FE-4D78-9E4F-7CE267355622} = {2D4838F0-251E-4383-9DAD-7FF91B0E0606}
{928B382F-48A0-4639-9EC0-0C9BE980C5C6} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{E6801B38-0264-456C-B8E6-A73262B6CBA7} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{3716FB3C-CDC3-45E7-9809-CF7F2DD30388} = {0027B7D2-664D-4872-AE99-BA2A2BCA6B2E}
{4B1A6E00-C5E7-4DA7-B234-36EA35CC9B44} = {147A1144-45E8-448A-9FD7-511C999E5727}
{19560515-92A4-4955-BDD9-E1CDA7E8A3BC} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{C56B8C71-AEFB-4B4C-9545-03F6A646A998} = {B4C40E02-E06A-4359-BDC5-349E103366AD}
{8401BAD4-7658-4357-859C-19F40E731848} = {92F3CAD3-DBF4-4587-A14D-8DECE4077D0C}
{681C6E43-9F8E-4A9B-AD03-12702CF47720} = {0027B7D2-664D-4872-AE99-BA2A2BCA6B2E}
{A92D009D-2C5B-46BC-893A-7AE995EE8814} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
Expand Down Expand Up @@ -311,7 +321,6 @@ Global
{4C1341A9-F5E2-4AB1-A504-5D815CAEEAF3} = {7212EE31-82F0-4741-B55F-7BCE0A3DFC5A}
{4C7CFA3D-355B-434F-8442-2B0970BF02C5} = {7212EE31-82F0-4741-B55F-7BCE0A3DFC5A}
{9508136B-0879-4BF2-B694-3B6242715BE7} = {175276C1-45BB-4C30-BB93-4CB2C2D4A60C}
{B57EEC99-85CF-4C4E-BB10-929CCD1D3723} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{147A1144-45E8-448A-9FD7-511C999E5727} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{0027B7D2-664D-4872-AE99-BA2A2BCA6B2E} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{92F3CAD3-DBF4-4587-A14D-8DECE4077D0C} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
Expand All @@ -325,6 +334,11 @@ Global
{BC6B8583-4F0F-45AD-BF71-1D998AA65869} = {84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7}
{F37BBDB4-EB48-42E4-8CB1-D459F5EF3C3F} = {B4C40E02-E06A-4359-BDC5-349E103366AD}
{67C7637A-1E86-49C0-8BBB-F91260F9058F} = {0027B7D2-664D-4872-AE99-BA2A2BCA6B2E}
{BEFA0F34-2594-4E77-88A9-4DF2B535343A} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{803BBEFE-A5AF-4C43-87FC-DA9132F18498} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{3BADD396-E830-468B-B2D8-A52FD5E6C6BD} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{5FA252B6-6FDA-451E-BE5E-F6D82EDE9AB1} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{F5D4C70F-DD2E-4EC9-A191-56A717B1B5EE} = {B4C40E02-E06A-4359-BDC5-349E103366AD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0143C230-7F40-44B2-8BA3-EF5B92D55848}
Expand Down
1 change: 0 additions & 1 deletion src/applications/Mixcore/CleanMixContent.bat

This file was deleted.

6 changes: 3 additions & 3 deletions src/applications/Mixcore/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected override void ValidateRequest()
[Route("{seoName?}")]
public async Task<IActionResult> Index()
{
string seoName = Request.RouteValues["seoName"]?.ToString();
string? seoName = Request.RouteValues["seoName"]?.ToString();
if (!IsValid)
{
return Redirect(RedirectUrl);
Expand All @@ -71,7 +71,7 @@ public async Task<IActionResult> Index()
}


private async Task<PageContentViewModel> LoadPage(string seoName = null)
private async Task<PageContentViewModel?> LoadPage(string? seoName = null)
{
var pageRepo = PageContentViewModel.GetRepository(Uow, CacheService);
Expression<Func<MixPageContent, bool>> predicate = p => p.MixTenantId == CurrentTenant.Id
Expand Down Expand Up @@ -101,7 +101,7 @@ private async Task<PageContentViewModel> LoadPage(string seoName = null)
}
return page;
}
private async Task<IActionResult> LoadAlias(string seoName)
private async Task<IActionResult> LoadAlias(string? seoName)
{
var alias = await MixUrlAliasViewModel.GetRepository(Uow, CacheService).GetSingleAsync(m => m.MixTenantId == CurrentTenant.Id && m.Alias == seoName);
if (alias != null)
Expand Down
2 changes: 1 addition & 1 deletion src/applications/Mixcore/Controllers/PageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public async Task<IActionResult> Index(int id, string keyword)
#endregion Routes

#region Helper
protected async Task<IActionResult> Page(int pageId, string keyword = null)
protected async Task<IActionResult> Page(int pageId, string? keyword = null)
{
// Home Page
var pageRepo = PageContentViewModel.GetRepository(Uow, _cacheService);
Expand Down
2 changes: 1 addition & 1 deletion src/applications/Mixcore/Controllers/PostController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public async Task<IActionResult> Index(int id, string seoName)
#endregion Routes

#region Helper
protected async Task<IActionResult> Post(int postId, string seoName = null)
protected async Task<IActionResult> Post(int postId, string? seoName = null)
{
// Home Post
var postRepo = PostContentViewModel.GetRepository(Uow, _cacheService);
Expand Down
15 changes: 12 additions & 3 deletions src/applications/Mixcore/Controllers/SecurityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Mix.Auth.Enums;
using Mix.Auth.Models;
using Mix.Database.Entities.Account;
using Mix.Heart.Exceptions;
using Mix.Lib.Services;
using Mix.Shared.Services;
using System.Security.Claims;
Expand Down Expand Up @@ -71,7 +72,7 @@ public ActionResult<JObject> ExternalLogin([FromForm] string returnUrl, [FromFor
[Route("security/external-login-result")]
[HttpGet]
[AllowAnonymous]
public async Task<ActionResult<JObject>> ExternalLoginResultAsync(string returnUrl = null, string remoteError = null)
public async Task<ActionResult<JObject>> ExternalLoginResultAsync(string? returnUrl = null, string? remoteError = null)
{
returnUrl = returnUrl ?? Url.Content("~/");
if (remoteError != null)
Expand All @@ -88,7 +89,11 @@ public async Task<ActionResult<JObject>> ExternalLoginResultAsync(string returnU
var siginResult = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false, bypassTwoFactor: true);
if (siginResult.Succeeded)
{
string email = info.Principal.FindFirstValue(ClaimTypes.Email);
string? email = info.Principal.FindFirstValue(ClaimTypes.Email);
if (string.IsNullOrEmpty(email))
{
throw new MixException(MixErrorStatus.Badrequest, "Email not exist");
}
var user = await _userManager.FindByEmailAsync(email);
var token = await _idService.GetAuthData(user, true, CurrentTenant.Id);
return View(new ExternalLoginResultModel()
Expand All @@ -104,7 +109,11 @@ public async Task<ActionResult<JObject>> ExternalLoginResultAsync(string returnU
else
{
// If the user does not have an account, then ask the user to create an account.
string email = info.Principal.FindFirstValue(ClaimTypes.Email);
string? email = info.Principal.FindFirstValue(ClaimTypes.Email);
if (string.IsNullOrEmpty(email))
{
throw new MixException(MixErrorStatus.Badrequest, "Email not exist");
}
var user = await _userManager.FindByEmailAsync(email);
if (user != null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/applications/Mixcore/Domain/Bases/MvcBaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected override void ValidateRequest()
}

#region Helper
protected async Task<IActionResult> Page(int pageId, string keyword = null)
protected async Task<IActionResult> Page(int pageId, string? keyword = null)
{
// Home Page
var pageRepo = PageContentViewModel.GetRepository(Uow, CacheService);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Newtonsoft.Json.Converters;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
using Ocelot.Cache.CacheManager;

namespace Microsoft.Extensions.DependencyInjection
{
Expand Down
2 changes: 1 addition & 1 deletion src/applications/Mixcore/Domain/Models/MenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public string Href

public List<MenuItem> MenuItems { get; set; }

public T Property<T>(string fieldName)
public T? Property<T>(string fieldName)
{
if (Obj != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public ApplicationViewModel()

public ApplicationViewModel(MixApplication entity,

UnitOfWorkInfo uowInfo = null) : base(entity, uowInfo)
UnitOfWorkInfo? uowInfo = null) : base(entity, uowInfo)
{
}

Expand All @@ -35,7 +35,7 @@ public ApplicationViewModel(UnitOfWorkInfo unitOfWorkInfo) : base(unitOfWorkInfo
public string MixDatabaseName { get; set; }
public int? MixDbId { get; set; }

public JObject ExtraData { get; set; }
public JObject? ExtraData { get; set; }
public TemplateViewModel Template { get; set; }
#endregion

Expand All @@ -54,7 +54,7 @@ public override async Task ExpandView(CancellationToken cancellationToken = defa

#region Public Method

public T Property<T>(string fieldName)
public T? Property<T>(string fieldName)
{
return ExtraData != null
? ExtraData.Value<T>(fieldName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public ModuleContentViewModel()
}

public ModuleContentViewModel(MixModuleContent entity,
UnitOfWorkInfo uowInfo = null) : base(entity, uowInfo)
UnitOfWorkInfo? uowInfo = null) : base(entity, uowInfo)
{
}

Expand All @@ -34,7 +34,7 @@ public ModuleContentViewModel(UnitOfWorkInfo unitOfWorkInfo) : base(unitOfWorkIn

public string DetailUrl => $"/Module/{Id}/{SeoName}";

public JObject AdditionalData { get; set; }
public JObject? AdditionalData { get; set; }
public PagingResponseModel<JObject> Data { get; set; }
public PagingResponseModel<ModulePostAssociationViewModel> Posts { get; set; }
#endregion
Expand All @@ -53,7 +53,7 @@ public override async Task ExpandView(CancellationToken cancellationToken = defa

#region Public Methods

public T Property<T>(string fieldName)
public T? Property<T>(string fieldName)
{
return AdditionalData != null
? AdditionalData.Value<T>(fieldName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public ModuleDataViewModel()

public ModuleDataViewModel(MixModuleData entity,

UnitOfWorkInfo uowInfo = null) : base(entity, uowInfo)
UnitOfWorkInfo? uowInfo = null) : base(entity, uowInfo)
{
}

Expand Down Expand Up @@ -46,7 +46,7 @@ public override Task ExpandView(CancellationToken cancellationToken = default)
#endregion

#region Helper
public string Property(string name)
public string? Property(string name)
{
return Data.Property(name)?.Value.ToString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ModulePostAssociationViewModel()

public ModulePostAssociationViewModel(MixModulePostAssociation entity,

UnitOfWorkInfo uowInfo = null)
UnitOfWorkInfo? uowInfo = null)
: base(entity, uowInfo)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public PageContentViewModel()

public PageContentViewModel(MixPageContent entity,

UnitOfWorkInfo uowInfo = null) : base(entity, uowInfo)
UnitOfWorkInfo? uowInfo = null) : base(entity, uowInfo)
{
}

Expand All @@ -39,7 +39,7 @@ public PageContentViewModel(UnitOfWorkInfo unitOfWorkInfo) : base(unitOfWorkInfo

public List<ModuleContentViewModel> Modules { get; set; }
public PagingResponseModel<PagePostAssociationViewModel> Posts { get; set; }
public JObject AdditionalData { get; set; }
public JObject? AdditionalData { get; set; }
#endregion

#region Overrides
Expand All @@ -62,11 +62,11 @@ public async Task LoadDataAsync(MixRepoDbRepository mixRepoDbRepository,
}


public ModuleContentViewModel GetModule(string moduleName)
public ModuleContentViewModel? GetModule(string moduleName)
{
return Modules?.FirstOrDefault(m => m.SystemName == moduleName);
}
public T Property<T>(string fieldName)
public T? Property<T>(string fieldName)
{
return AdditionalData != null
? AdditionalData.Value<T>(fieldName)
Expand Down
Loading

0 comments on commit c03beae

Please sign in to comment.