In your example, you use the interface as a component id.
In my example, IStatistic is a "regular" entity, which has a one-to-many
relationship with the entiy Action: Action (n) <----- (1) IStatistic
The particularity of IStatistic, if that the concrete classes which
implement it are immutable, and have only readonly properties. If I have,
for example, 6 classes which implement this interface, I will always have
only 6 rows in my table. No more, no less.
These rows will be inserted just after the database is created, will all
have a unique id (as all entities do), and when an action needs to reference
a IStatistic entity, this last entity will be loaded from the database, so
the relationship can be made.
So if I have a concrete class implementing IStatistic, named Shoot for
example, I will never do something like:
var action = new Action()
{
Statistic = new Shoot()
};
but I would have something like:
var stat = Session.Load<IStatistic>(2); //2 being the id of the shoot entity
in my table
var action = new Action()
{
Statistic = stat
};
I hope I have been more clear, feel free to tell me :)
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.