Hi All,
I'm all new and fresh on C# but not on hibernate, but im somewhat lost
when it comes to inheritance and the use of Fluent in this case.
I have a Table called Property which has one or many PropertyFeatures.
Now Property Features can either be a Service, Inclusion or a feature
and these are distinguished with the use of a Char field, "S", "I",
"F"
Property Table:
ID
Title
etc
Property Feature
ID
property_id
featureType ("F", "I", "S")
feature_id
Feature / INCLUSION / SERVICE Table
ID
DESC
Now the i have 5 Classes (Property, PropertyFeature, Inclusion,
Service and Feature) , where PropertyFeature class has ID, property,
type (discriminator) and Inclusion, Service, Feature all inherit from
PropertyFeature Class and they only implement feature_id;
My question is this; how would one Map this? should i have a mapping
for Property and PropertyFeature classes only, with the following in
the PropertyFeatureMapping class?
DiscriminateSubClassesOnColumn<Char>("PropertyFeatures_Type")
. SubClass<PropertyFeature>(Convert.ToChar("F"),
m => m.HasOne(x => x.FSI )
.Cascade.All()
.FetchType.Join())
.SubClass<PropertyInclusion>(Convert.ToChar("I"),
m => m.HasOne(x => x.FSI)
.Cascade.All()
.FetchType.Join())
.SubClass<PropertyService>(Convert.ToChar("S"),
m => m.HasOne(x => x.FSI)
.Cascade.All()
.FetchType.Join());
}
Or should there be another way. The above implementation gives me the
following error:
Association references unmapped class:
Appreciate any help. Thanks in advance
Regards
Nick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---