-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
UserInfo
ansonzhang edited this page Oct 15, 2019
·
3 revisions
注意:下边的代码在 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;
有疑问,请自行查看博客园文章:https://www.cnblogs.com/laozhang-is-phi/p/9495618.html#autoid-1-0-0
或者加 QQ 群:867095512
-
- AOP
- Appsettings
- Async-Await
- Authorization-Ids4
- Authorization-JWT
- AutoMapper
- CORS
- DI-AutoFac
- DI-NetCore
- Filter
- GlobalExceptionsFilter
- HttpContext
- Log4
- MemoryCache
- Middleware
- MiniProfiler
- publish
- Redis
- Repository
- SeedData
- SignalR
- SqlSugar
- SqlSugar-Codefirst&DataSeed
- SqlSugar-SqlAOP
- Swagger
- T4
- Test-xUnit
- Temple-Nuget
- FAQ page is a good place to see whether your question is already asked.
- Ask a question in cnblogs if you need help.
- Submit an issue if you found a bug or have a feature request.
- Open a pull request when you prepared to contribute. Before that, it is encouraged to open an issue to discuss.