Running Westwind globalization in a separate project

861 views Asked by At

I have a .net mvc solution with multiple projects and would like to use the Westwind globalization outside of the main mvc project.

I realize I can't run the Westwind app in a class library so what I was trying to do is have the web interface run in the main project and then have the Resources.cs created into its own project. (main reason is the different projects that would need it would cause a circular redundancy issue)

What I tried to do was setup the web.config stronglyTypedGlobalResource="..\Westwind\Properties\Resources.cs,AppResources" but I can't do a relative project below the root.

Maybe there is a better way to accomplish this other than the web.config change. Any suggestions would be great.

For those reading that don't know the Westwind, basically it will create a resources.cs file for language translation based on a database table. So westwind isn't really the issue, just want project a to save a file to project b.

Thanx

1

There are 1 answers

0
Rick Strahl On

You can absolutely run Westwind.Globalization inside of a class library as long as you can run with a single configuration that accesses the same configuration setting values that the running application will end up pulling from web.config.

Version 1 makes this a little awkward because the NuGet package pulls in a bunch of Web specific resources. Version 2 provides a core library that doesn't include any of the Web resources and includes only the core components, so this is a lot cleaner than with V1.

Beyond that however, I suggest that you don't actually use dbResources in class library projects, but rather generate Resx resources from your Db resources by exporting to .Resx. This way that DLLs are truly self contained, while the Web application (the front end code) can dynamically adjust the interface as needed using dbResources (or you can also export those resources to Resx). Version 2 makes this much easier as well in that you can export resources to arbitrary folders on your hard drive and not just Web specific folders.