Guest User

Untitled

a guest
May 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. public class OrganizationMap : IAutoMappingOverride<Organization>
  2. {
  3. public void Override(AutoMap<Organization> mapping)
  4. {
  5. }
  6. }
  7.  
  8. <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="">
  9. <class name="Orders.Core.Organization, Orders.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" table="Organizations" xmlns="urn:nhibernate-mapping-2.2" />
  10. </hibernate-mapping>
  11.  
  12. public class UserMap : IAutoMappingOverride<User>
  13. {
  14. public void Override(AutoMap<User> mapping)
  15. {
  16. mapping.JoinedSubClass<Organization>("ColumnId", m => {...}
  17. );
  18. }
  19. }
  20.  
  21. public class MyAlteration : IAutoMappingAlteration
  22. {
  23. public void Alter(AutoPersistenceModel model)
  24. {
  25. model.ForTypesThatDeriveFrom<User>(
  26. map => map.HasMany<User>( x => x.Children)
  27. );
  28. }
  29. }
  30.  
  31. model.Alteration( a => a.Add<MyAlteration>());
  32.  
  33. mapping.JoinedSubClass<Organization>("UserId", m =>
  34. {
  35. m.HasMany(x => x.Currencies).Element("Currency").AsBag();
  36. }
  37. );
  38.  
  39. public class OrganizationMap : IAutoMappingOverride<Organization>
  40. {
  41. public void Override(AutoMapping<Organization> mapping)
  42. {
  43. mapping.HasMany(x => x.Currencies).Element("Currency").AsBag();
  44. }
  45. }
Add Comment
Please, Sign In to add comment