This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
注意:下边的代码在 netcore 3.0分支的,可以下载看看,但是同样适用于2.2,只不过master分支我没有修改而已。
Blog.Core.Common / HttpContextUser / IUser.cs
Blog.Core.Common / HttpContextUser / AspNetUser.cs
services.AddScoped<IUser, AspNetUser>();
构造函数注入:
private readonly IUser _user; public ModuleController(IModuleServices moduleServices, IUser user) { _moduleServices = moduleServices; _user = user; }
直接使用:
module.CreateId = _user.ID; module.CreateBy = _user.Name;
框架说明
快速运行
主要知识点
API 地址
Deleting the wiki page "UserInfo" cannot be undone. Continue?