c# - 方面未触发 CQRS
问题描述
我的查询中有这样的功能,但除了句柄功能之外,我无法使用其他方面。不触发方面。我应该怎么办?我正在尝试使用 CQRS 模式来实现它。
[ExceptionLogAspect(typeof(FileLogger))]
public async Task<IDataResult<IEnumerable<PostDto>>> Handle(GetAllPostsQuery request, CancellationToken cancellationToken)
{
....
}
[ExceptionLogAspect(typeof(FileLogger))]
[SecuredOperation(Roles.Admin)]
private async Task<IEnumerable<PostDto>> GetAllNotActivePosts()
{
....
}
[ExceptionLogAspect(typeof(FileLogger))]
private async Task<IEnumerable<PostDto>> GetAllActivePosts()
{
....
}
}
Autofac 模块
builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces()
.AsClosedTypesOf(typeof(IRequestHandler<,>));
builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces()
.EnableInterfaceInterceptors(new ProxyGenerationOptions
{
Selector = new AspectInterceptorSelector()
}).SingleInstance();
解决方案
推荐阅读
- python-3.x - 在tkinter中单击时如何删除网格按钮
- javascript - fs.writeFileSync 到 fs.writeFile
- django - Django rest 框架查询集给了我 .pk 我想要的 .name
- java - 适配器未在列表视图中显示数组列表项,但在用于测试的 Toast msg 中显示字符串
- eclipse - 在 Eclipse 中创建新的 Gradle 项目失败
- emacs - DOOM emacs 垂直移动 Cider REPL 窗口
- python - 如何在 QTreeView 或 QListView 中设置 ItemFlag?
- php - Xdebug 无缘无故地默默捕获连接
- sql - 应用条件时的第一个日期和最后一个日期
- c++ - 相同的线程在屈服后不断被重新安排