修改可空类型
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Yi.Framework.WebCore.AspNetCoreExtensions
|
||||
|
||||
public static void UseLocalizerService(this IApplicationBuilder app)
|
||||
{
|
||||
Result._local = app.ApplicationServices.GetService<IStringLocalizer<LocalLanguage>>();
|
||||
Result._local = app.ApplicationServices.GetRequiredService<IStringLocalizer<LocalLanguage>>();
|
||||
|
||||
var support = new[] { "zh", "en" };
|
||||
var local = new RequestLocalizationOptions().SetDefaultCulture(support[0])
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Yi.Framework.WebCore.DbExtend
|
||||
|
||||
|
||||
var roles = userRoleMenu?.Roles;
|
||||
if (roles.IsNull())
|
||||
if (roles!.IsNull())
|
||||
{
|
||||
roles = new();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Yi.Framework.WebCore.FilterExtend
|
||||
var logModel = new LogModel()
|
||||
{
|
||||
OriginalClassName = "",
|
||||
OriginalMethodName = actionName,
|
||||
OriginalMethodName = actionName??"",
|
||||
Remark = $"来源于{nameof(CustomExceptionFilterAttribute)}.{nameof(OnException)}"
|
||||
};
|
||||
this._logger.LogError(context.Exception, $"{url}----->actionName={actionName} Message={context.Exception.Message}", JsonConvert.SerializeObject(logModel));
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace Yi.Framework.WebCore.FilterExtend
|
||||
|
||||
LogModel logModel = new LogModel()
|
||||
{
|
||||
OriginalClassName = controllerName,
|
||||
OriginalMethodName = actionName,
|
||||
OriginalClassName = controllerName??"",
|
||||
OriginalMethodName = actionName ?? "",
|
||||
Remark = $"来源于{nameof(LogActionFilterAttribute)}.{nameof(OnActionExecuting)}"
|
||||
};
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
||||
//通过鉴权之后,开始赋值
|
||||
_currentUser.IsAuthenticated = true;
|
||||
_currentUser.Id = claims.GetClaim(JwtRegisteredClaimNames.Sid) is null ? 0 : Convert.ToInt64(claims.GetClaim(JwtRegisteredClaimNames.Sid));
|
||||
_currentUser.UserName = claims.GetClaim(SystemConst.UserName);
|
||||
_currentUser.UserName = claims.GetClaim(SystemConst.UserName)??"";
|
||||
_currentUser.Permission = claims.GetClaims(SystemConst.PermissionClaim);
|
||||
_currentUser.TenantId = claims.GetClaim(SystemConst.TenantId) is null ? null : Guid.Parse(claims.GetClaim(SystemConst.TenantId)!);
|
||||
await _next(context);
|
||||
|
||||
Reference in New Issue
Block a user