Hi,
I am wondering how you would approach this problem
I have two Taxrates that can apply to my products. I specifically want to avoid persisting the Taxrates into the database while still being able to change them in a central place (like Taxrate from 20% to 19% etc).
so I decided it would be great to have them just compiled into my application (It's internal). The problem is that I want to not only to know the Rate but also the Name of the Taxrate.
I could go with an Enum that maps to the value. But then I'd have to create some method that retrieves the German Name of that Taxrate for the English enum-value (I write my code in english, the App is in german).
I thought about just using hardcoded objects to reflect this,
public interface Taxrate
{
string Name { get; }
decimal Rate { get; }
}
public class NormalTaxRate : Taxrate
{
public string Name
{ get { return "Regelsteuersatz"; } }
public decimal Rate
{ get { return 20m; } }
}
But then I'd have to create some sort of list that holds two instances of those two objects. Doing it static may work, but still I'd have to keep some sort of list. Also I'd have to find a way to map my POCO Domain Object to this, because I doubt NHibernate can instantiate the right Object depending on a value in a field.
It doesn't really feel right, and I think I'm missing something here. Hope somebody has a better solution, I can't think of one.
greetings, Daniel
Ps: also please retag this question if you find something fitting, I can't think of more meaningful tags right now.