Public Access To TypeSafe resources

  • Thread starter Thread starter Davo
  • Start date Start date
D

Davo

I wish to setup a resource that holds CONSTANT values. The resource
file is call LogCat.resx (Logger Categories) and contains Debug, Info,
Error etc...

This resource is located in a resource only assembly and uses the
custom tool SettingsSingleFileGenerator to generate a typesafe class.

The problem is that the class and all its members are internal so I
cannot access it from other assemblies

Cheers Dave
 
Davo,

Why not just create a wrapper class for it then that is public?
 
Creating a public accessible class is certainly possible but it defeats
the purpose of Auto Class Generation that is allready built in to .NET 2

I might as well not botthered with a resource file and just used regular
constant class declaration.

I guess what I'm after is a custom code generator for this particular
RESX file or options for the current code generator that will allow it
to generate public accessors.

Dave
 
Why not just create a wrapper class for it then that is public?

Creating a public accessible class is certainly possible but it defeats
the purpose of Auto Class Generation that is allready built in to .NET
2

I might as well not botthered with a resource file and just used
regular constant class declaration.

I guess what I'm after is a custom code generator for this particular
RESX file or options for the current code generator that will allow it
to generate public accessors.

Dave
 
Davo,

Well, you could create your own custom tool which will do this for you.
For more details on how to do this, check out:

http://www.drewnoakes.com/snippets/WritingACustomCodeGeneratorToolForVisualStudio/

From this, it is easy to figure out how to access the functionality of
the original generator. From there, you can have the original generate your
code, then use the classes from CodeDom to parse the code apart. Once you
have that, you just set the access modifier to public, and have CodeDom
re-generate the text needed.

Hope this helps.
 
Back
Top