1

First of all, I have read a lot of post relating this issue like: Asp.net MVC RouteBase and IoC , Tenant-specific routes for dynamically loaded modules , and many others.

What I want is: - Dynamically create pages like tenant1.mydomain.com, tenant2.mydomain.com, etc. - My tenants will have the same functionality but just different content, styles, title, etc.

I have tried extending RouteBase class but have read that is not a clean solution. Then I have tried creating a custom RouteConstraint like above posts recommend but not succeded.

Help me!

Thanks!

4

1 回答 1

0

我通过做两件事实现了这一点。1) 是通过工厂提供存储库来提供选择正确内容的功能,工厂在创建时将 URL 传递给该工厂。这里的问题是,可能通过关系从本身没有 Tennantid 字段的实体中获取错误的数据。

2) 是一个基本的自定义视图引擎,它查找 URL 的主机部分,如果发现使用了该模板,它将查找客户端特定模板(通过文件夹结构),否则返回默认模板。

在这两者之间,我有一个系统可以通过相同的定制 CMS 和产品管理工具提供(在我的情况下)多个网站。

于 2012-05-05T16:24:26.800 回答