Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6691261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:43:52+00:00 2026-05-26T05:43:52+00:00

I have a project which has multiple Resource (resx) files along with the accompanying

  • 0

I have a project which has multiple Resource (resx) files along with the accompanying .designer.cs generated files. Each of these classes has a public static property of type System.Resources.ResourceManager.

What I can’t seem to figure out is how to get the configuration right for unity so that I can resolve it and execute. Obviously, the code below will not work – since it will not let me register the object that way.

public static string GetStringValue(name, tokenName)
{ 
   using (IUnityContainer container = new UnityContainer())
   {
        container.LoadConfiguration("ResourceManagers");
        var resolvedManager = container.Resolve<ResourceManager>(name);
        return resolvedManager.GetString(tokenName);
   }
}

And given the following configuration…

<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
    <assembly name="Web" />
    <container name="ResourceManagers">
      <register name="Manager1" mapTo="Web.Manager1Strings.ResourceManager" type="System.Resources.ResourceManager" />
    </container>
  </unity>

here is the designer code – this is generated by codedom.

public class Manager1Strings 
{
    ...
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Web.Resources.Manager1.Manager1Strings", typeof(Manager1Strings).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
    ...
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:43:53+00:00Added an answer on May 26, 2026 at 5:43 am

    Okay I was able to resolve this issue but it was only because I had control over the generation of the designer files (CodeDom).

    In summary:

    1. I created an interface which had 1 method “GetString”
    2. I tweaked the CodeDom logic (similar to this) to implement the interface.
    3. I was then able to resolve instances of the interface via unity
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder structure that contains multiple javascript files, each of these files
I have a dot net windows service project which contains multiple services. This has
I have a solution which has multiple output projects (a website, and admin tool,
I have a solution in Visual Studio 2008 which has multiple projects. One of
I have a project which has a set of binary dependencies (assembly dlls for
I have a project which has shared functionality between three other projects and have
ok i have a project which has many gridview in its pages... now i
I have a Rails project which has a Postgres database for the actual application
We have a git project which has quite a big history. Specifically, early in
I have a project directory which has an .acignore file containing: out/* The project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.