简体   繁体   中英

.Net MVC3 resource file and multi-tenancy

I have learned much and solved a lot of problems coming up with multi-tenancy. But one problem still exists. I have to offer a tenant-specific resource file because our customers want some text a little different then other customers. Is there a way to implement a multi-tenant resourceManager? I haven't found anything else in the www.

We needed the same functionality in a web forms project and ended up implementing our own IResourceProvider, finding inspiration in http://msdn.microsoft.com/en-us/library/aa905797.aspx . That way we could have files like Default.aspx.rex, Default.aspx.da-DK.resx and Default.aspx.da-DK.xyz.resx, where xyz was the customer name. This worked quite well. Going this way seems to imply using the App_LocalResources and App_GlobalResources folders.

However, those folders are not the MVC way of using resources and will cause problems. For instance, they will not work properly with unit testing. As a last resort you might find it useful though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM