Hello,

I have some confusion about how to best handle meta-ownership of
parent/child records. Briefly, I have a statistics table whose rows
may be owned by one of several parent tables.

In order to do this, I am using Fluent's AddMetaValue from the
AnyPart<T>, but I think I am confused about its usage.

Somewhere along the way I thought this applied to typeof (TModel) with
a valueMap of typeof (TClassMap) where TClassMap is ClassMap<T>.

Initial assignment of the domain model is correct. I assign instance
of Parent to Child class' HostModel property. Type shows typeof
(Parent), all is well.

However, when the object saves, the meta value shows ParentMap, which
I do not think is correct, and hence part of my confusion.

Here's an example of my extension method to handle this. I know what I
was driving for, but I don't recall why I was assuming TClassMap?
Except, perhaps as a way of enforcing that TClass should be mapped.

public static AnyPart<T> AddMetaValue<T, TClass, TClassMap>(this
AnyPart<T> part)
    where TClassMap : ClassMap<TClass>
    where TClass : T
{
    return part.AddMetaValue(typeof (TClass), typeof (TClassMap).Name);
}

I think probably that should read more like:

return part.AddMetaValue(typeof (TClass), typeof (TClass).Name);

Thoughts? Insights?

Thank you,

Michael Powell

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at https://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to