From 84079146cf4c179cfe2770386dcd9f1cd1e7b14a Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 10 Mar 2020 03:04:23 +0800 Subject: ... --- Timeline/Models/Http/UserInfo.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Timeline/Models/Http/UserInfo.cs') diff --git a/Timeline/Models/Http/UserInfo.cs b/Timeline/Models/Http/UserInfo.cs index 68c6d8bd..fcbbe7c9 100644 --- a/Timeline/Models/Http/UserInfo.cs +++ b/Timeline/Models/Http/UserInfo.cs @@ -2,19 +2,19 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Routing; -using Timeline.Controllers; -using Timeline.Services; +using System; +using TimelineApp.Controllers; -namespace Timeline.Models.Http +namespace TimelineApp.Models.Http { public class UserInfo { public string Username { get; set; } = default!; public string Nickname { get; set; } = default!; public bool? Administrator { get; set; } = default!; -#pragma warning disable CA1707 - public UserInfoLinks? _links { get; set; } -#pragma warning restore CA1707 +#pragma warning disable CA1707 // Identifiers should not contain underscores + public UserInfoLinks _links { get; set; } = default!; +#pragma warning restore CA1707 // Identifiers should not contain underscores } public class UserInfoLinks @@ -24,7 +24,7 @@ namespace Timeline.Models.Http public string Timeline { get; set; } = default!; } - public class UserInfoLinksValueResolver : IValueResolver + public class UserInfoLinksValueResolver : IValueResolver { private readonly IActionContextAccessor _actionContextAccessor; private readonly IUrlHelperFactory _urlHelperFactory; @@ -35,10 +35,10 @@ namespace Timeline.Models.Http _urlHelperFactory = urlHelperFactory; } - public UserInfoLinks? Resolve(User source, UserInfo destination, UserInfoLinks? destMember, ResolutionContext context) + public UserInfoLinks Resolve(User source, UserInfo destination, UserInfoLinks destMember, ResolutionContext context) { if (_actionContextAccessor.ActionContext == null) - return null; + throw new InvalidOperationException("No action context, can't fill urls."); var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext); var result = new UserInfoLinks -- cgit v1.2.3