创建一个处理其他模块的模块 [英] Creating a module which handle other modules

查看:34
本文介绍了创建一个处理其他模块的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚涉足 Orchard,对于任何令人困惑的术语,我深表歉意.根据我的学习和阅读,您几乎可以自定义 Orchard 以包含或排除您想要的任何内容,因为它首先是一个框架,因此像 MVC、模块这样的功能确实是框架的一部分,但它并不是本质上基于的.<块引用>

是否可以创建一个与其他模块交互的模块?

为了清楚起见,假设我们有一个模块执行 API 调用之类的操作,获取数据并将其显示给用户.我怎样才能创建一个模块来控制这个模块的行为(什么时候,为什么)?何时,为什么这个模块只会控制何时这个模块应该被执行,如果不是**为什么**是什么意思.

这可以在模块本身上实现,但是假设我们有很多模块几乎相同的东西.为了遵循 DRY,我们当然需要在单独的模块中单独控制这个模块.

先谢谢你!

就像构建一个 httpmodule,它将捕获所有请求,然后决定通过哪个请求.

解决方案

根据你的 post 在 GitHub 上,您可以实施 IAuthorizationServiceEventHandler 并且在该实现中,您可以调用外部 API 来检查特定权限.

我过去曾亲自检查过配置/存储在单独数据库中的细粒度权限.

I just got involved in Orchard, so I apologize for any confusing terms. from what I learned and read you can pretty much customize Orchard to include or exclude anything you want since its a framework in the first place, so features like MVC, modules are really parts of the framework but not it's not essentially based on.

is it possible to create a module which interacts with other modules?

To make it clear, say we have a module which does something like an API call, fetching data and displaying it to the user Only. how can I create a module that will control this module behavior (when, why)? what is meant by When, Why this module will only control when this module should be executed and if not **why **.

this can be implemented on the module itself, but say we have a lot of module with pretty much the same thing .to follow the DRY we will certainly need to separate controlling this module in a separate module.

Thank you in advance!

EDIT: its like building an httpmodule which will catch all requests then decide which one pass through .

解决方案

According to your post on GitHub you can implement IAuthorizationServiceEventHandler and in that implementation you can call your external API to check for a specific permission.

I've done this myself in the past to check for fine grained permissions that were configured / stored in a separate DB.

这篇关于创建一个处理其他模块的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆