code_junkie

NHibernate mapping with a class hierarchy whose base class is abstract and the discriminator is not a string

Nov 12th, 2011
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. public abstract class BaseClass
  2. {
  3. ...
  4. }
  5.  
  6. public class ChildClass : BaseClass
  7. {
  8. ...
  9. }
  10.  
  11. DiscriminateSubClassesOnColumn<byte>("Type")
  12. .SubClass<ChildClass>()
  13. .IsIdentifiedBy((byte)OperationType.Plan)
  14. .MapSubClassColumns(p => { ... })
  15.  
  16. SetAttribute("discriminator-value", "-1");
  17.  
  18. DiscriminateSubClassesOnColumn<sbyte>("Type", (sbyte)-1)
Add Comment
Please, Sign In to add comment