每个客户端母版页分离

发布于 2024-11-04 09:30:05 字数 642 浏览 1 评论 0原文

在我目前正在进行的项目中,我们正在开发一种产品,最终将在各种不同的客户站点上使用。目前完成的方式是所有客户端的所有代码都包含在一个解决方案中,目前只有大约 5 个左右的客户端,因此它是可管理的,但我想重新组织它,以便我们可以将这些部分移出到客户的特定领域。

关于各种客户端的实际装配,我认为我们可以使用 MEF 或 IOC 轻松实现灵活的东西。

我不确定的领域是网络方面。当前每个客户端都有自己的母版页,这些母版页完全不同,除了具有相同的内容区域之外,定制可能无法仅通过纯 CSS 来实现。

有没有办法拥有一个通常会使用的“基本”母版页,然后如果我们想部署到客户端 A,我们可以以某种方式注入客户端作为母版页。目前,这是由所有引用 Master.master 作为其母版页的内容页面处理的,然后有一个通用的 Master.master,当部署到客户端 A 时,我们将 Master.master 重命名为某个名称,并重命名为客户端专门定制的母版页A (ClientA.master) 到 Master.master 并部署。

所有这一切的缺点是,所有母版页都保存在一个 Web 项目中,如果我们尝试前往与客户端无关的主分支,这感觉有点错误,除非其他母版页作为即使没有使用它们,客户端也会在其服务器上获得它们的部署,并且我们最好不希望一个客户端能够切换到另一个客户端视图等(不是安全方面的,它会产生任何影响)

On the current project I'm working on we are developing a product that eventually gets used at various different client sites. At the moment the way things are done is that all code for all of the clients is included in the one solution, currently there's only about 5 or so clients so its manageable but I'd like to reorganize this so we can move these bits out to client specific areas.

In regards to the actual assemblies for various clients I think we can easily achieve something flexible using MEF or IOC.

The area im not sure about is the web side of things. Each client current has their own master page and these master pages are fairly radically different, apart from having the same content areas, the customization is probably not able likely to just be achieved by pure CSS.

Is there a way to have a "base" masterpage that would normally get used and then if we want to deploy to client A we can just inject somehow client As master page. Currently this is handled by all of the content pages referring to Master.master as their master page and then there is a generic Master.master, when deploying to client A we rename Master.master to something and rename the specifically tailored master page for client A (ClientA.master) to Master.master and deploy.

The down side to all of this is that all of the master pages are kept in the one web project which feels a bit wrong if we are trying to head to a client agnostic main branch, and unless the other master pages are deleted as part of the deployment the client would get a copy of them on their server even though they aren't used and preferrably we'd not like to have one client being able to switch to another clients view etc (not that security wise it would have any effect)

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

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

发布评论

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

评论(1

ㄟ。诗瑗 2024-11-11 09:30:05

您检查过主题吗?我们之前已经使用过主题来处理这类事情。

如果这对你来说没有足够的能力,你可以在 pre_init 阶段做你想做的事情。我们在某些地方使用此代码

protected void Page_PreInit(object sender, EventArgs e)
    {
        this.MasterPageFile = "~/page.master";
    }

您当然可以使用逻辑来确定您希望使用哪个母版页。

Have you checked out Themes. We have used themes for this sort of thing before.

If that does not have enough power for you you can do what you want in the pre_init phase. We use this code in some places

protected void Page_PreInit(object sender, EventArgs e)
    {
        this.MasterPageFile = "~/page.master";
    }

You can of course use logic to determine what master page you wish to use.

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