Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The Entity
- public class MyEntity : EntityBase
- {
- private IList<SomeKindOfRelatedType> _relatedStuff;
- public IList<SomeKindOfRelatedType> RelatedStuff
- {
- get
- {
- if (relatedStuff == null)
- {
- relatedStuff = new List<SomeKindOfRelatedType>();
- }
- if (!IsNew)
- {
- this.Initialize(/*x, y, z*/);
- }
- return relatedStuff;
- }
- }
- private IList<SomeKindOfRelatedType> relatedStuff
- {
- get { return _relatedStuff; }
- set
- {
- _relatedStuff = value;
- OnNotifyPropertyChanged("RelatedStuff");
- }
- }
- }
- // An extension method defined somewhere else,
- // but obviously in the same assembly as the entities
- // since it's called from within the entities. :\
- public static void Initialize(this EntityBase entity, /*x, y, z*/)
- {
- using (var session = SessionManager.Instance.GetSession())
- {
- // new transaction
- // load data from NH
- }
- }
Add Comment
Please, Sign In to add comment