NuGet Project Uncovered: Enum Metadata Library
If you are coming to this series of posts for the first time you might check out my introductory post for a little context.
EnumMetadata.Core provides some clean extensions over enums that give you access to metadata you place on enum values. This project?s approach is to use attributes on an Enum and some fancy extension methods to get at the data stored in attributes in a strongly typed way.
I couldn?t quickly get this project up and running on my x64 machine. I received the good ol BadImageFormat exception. I didn?t take enough interest to get it working at the time, and was able to get a pretty good picture of how to use it from the tests (if I had to). Just knowing this project is here is good enough for me at the moment.
Side Note: It?s a different approach to the problem. Another strongly typed approach I tend to prefer can be found at the following Gist here. Not exactly an ?enum? but gives a similar feel with access to more metadata and gives the possibility of adding behavior to each item.
That alternative approach is the “Type Safe Enum” pattern isn’t it?
http://stackoverflow.com/a/424414/424788
I’ve used that a few times now and it works well. Relatively easy to persist with NH using Fabio Maulo’s WellKnownInstanceType.
Thanks for pointing me to the pattern. Yes it appears to be the same thing. (Guess it’s a good thing when you “discover” a pattern.)
http://nuget.org/packages/enumeration