Created
October 25, 2010 13:53
-
-
Save hotgazpacho/644989 to your computer and use it in GitHub Desktop.
Abstract base class with multiple subclasses. Some subclasses have additional properties in DetailXXX tables. DB lacks FK relationships. Relationships are mapped on "natural" composite keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Component is an abstract base class | |
| // Weld inherits from Component | |
| // Weld has additional properties in DetailWeld table | |
| public class ComponentMap : ClassMap<Component> | |
| { | |
| public ComponentMap() | |
| { | |
| Table("Component"); | |
| CompositeId().KeyProperty(x => x.ItemId).KeyProperty(x => x.RevNo); | |
| // Properties mapped here | |
| DiscriminateSubClassesOnColumn("ComponentTypeId", 4); | |
| } | |
| } | |
| public class WeldMap : SubclassMap<Weld> | |
| { | |
| public WeldMap() | |
| { | |
| DiscriminatorValue(8); | |
| Join("DetailWeld", | |
| wd => | |
| { | |
| wd.KeyColumn("ItemId"); | |
| wd.KeyColumn("RevNo"); | |
| //More properties mapped here | |
| }); | |
| } | |
| } |
Author
Yes on swapping the order of calls to KeyColumn.
FNH is 1.1 binary (1.1.0.685)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I assume if you swap the two
wd.KeyColumnlines around the exception changes to be... (...:DetailWeld [ItemId])? That would certainly indicate that the second call is overwriting the first.Are you using the
masterversion or the 1.1 binary?