I am using nhibernate and have a table called tiers. A user makes in a form all the tiers they need.
It could look like this
Use Teir one up to $600 then use --
Use Teir two up to $1000 then use tier1
Use Tier three up to $1500 then use Tier 1
Use Tier four up to $2000 then use Tier 2
In my database I have a field called “useTierAfter”. This stores the PK of the tier it should use after the limit.
If Tier two is setup to have $1000 cap anything over that amount would use the tier one amount.
Now what I am not sure is in my fluent/domain nhibernate mapping should I have just a Guid as a property or should I have a Tier object in it?
public class Tier
{
public virtual Tier UseTierAfter { get; set; }
// or
public virtual Guid UseTierAfter { get; set; }
}
I am not sure what is a better way to do this.
This can be done, and is perfectly reasonable. But you’re not having an object containing the same object. Just an object containing a reference to another object of the same class.