Any ideas? As I'm at a complete loss at this point. On Jan 6, 11:32 am, Chris Marisic <[email protected]> wrote: > I know there are alot of posts on here about this (has nothing really > changed in NH core to fix this? I've seen the JIRAs dating back to > 2006-2007 with this) but from what I was able to gleam from them I > couldn't make any progress resolving this issue. > > All of my NH entities dervive from a type called BusinessEntity, it > has the most basic values ID, Created, CreatedBy, Updated, UpdatedBy. > > CreatedBy / UpdatedBy takes a User > > I have a IPreUpdateEventListener and IPreInsertEventListener that fire > to get the current DateTime for the audit values. Also in here I have > my logic to get the current user running which I grab by running a > criteria query against the windows user principle. From what I > understood from all of these posts on this subject my User class needs > to be eagerly loaded for this to work correctly in my EventListeners > this is how I load the user > > public User GetByDomainPrinciple(string domainPrinciple) > { > var domainPrincipleCriteria = DetachedCriteria.For<User>() > .Add(Restrictions.Eq("DomainPrinciple", > domainPrinciple)) > .SetFetchMode("Roles", FetchMode.Eager) > .SetFetchMode("Groups", FetchMode.Eager) > .SetFetchMode("Groups.Roles", FetchMode.Eager) > .SetCacheable(true) > ; > > return Repository.QuerySingle(domainPrincipleCriteria); > } > > Repository.QuerySingle(domainPrincipleCriteria); is just > > return detachedCriteria.GetExecutableCriteria > (_conversation.Session).UniqueResult<T>(); > > Am I missing something or my criteria query wrong? I guess absolute > worst case scenario I could change CreatedBy to be a Guid instead of a > User and just manually assign the FK like that, but that seems very > dirty.
-- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
