您可以使用结构图将依赖项注入 postsharp 属性吗

发布于 2024-10-03 20:09:10 字数 118 浏览 0 评论 0原文

我使用结构图进行依赖项注入,现在我还想使用 postsharp 在我的服务层进行一些授权检查。因为我的服务层拥有所有注入的存储库,有没有办法可以将这些存储库注入或传递给 postsharp 属性来查询 sql 并提供授权?

I use structure map for dependencies injection, I also now want to use postsharp for some authorisation checking at my service layer. because my service layer has all injected repositories is there a way I can inject or pass these repositories to the postsharp attribute to query the sql and provide authorisation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾北清歌寒 2024-10-10 20:09:10

我从未使用过 PostSharp - PostSharp 属性中的代码是在运行时执行,还是在编译后预运行时阶段执行?

如果代码在运行时执行,您应该能够使用静态网关 (ObjectFactory.GetInstance) 进行服务定位。

I've never used PostSharp - does the code in the PostSharp attributes execute at runtime, or during a post-compile pre-runtime stage?

If the code executes at runtime, you should be able to do service location using a static gateway (ObjectFactory.GetInstance).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文