Example #1
0
        private void Evict(ORMGOUser result, NHibernate.ISession session)
        {
            foreach (var entity in session.GetSessionImplementation().PersistenceContext.EntitiesByKey.Values.ToArray())
            {
                var evictee = entity as ORMGOUser;

                if (evictee != null && evictee.Id == result.Id)
                {
                    session.Evict(evictee);
                }
            }
        }
Example #2
0
        public override IORMEntity ToORMEntity()
        {
            var session = NHibernateSessionController.GetCurrentSession();

            var result = new ORMGOUser();

            CopyTo(result, session);

            // Ensure no copy of result (instance with same key) in session
            Evict(result, session);

            return(result);
        }
Example #3
0
 protected void CopyTo(ORMGOUser x, NHibernate.ISession session)
 {
     x.Id             = Id;
     x.EmailAddress   = EmailAddress?.Truncate(150);
     x.FullName       = FullName?.Truncate(250);
     x.LastName       = LastName?.Truncate(100);
     x.Password       = Password?.Truncate(150);
     x.FirstName      = FirstName?.Truncate(100);
     x.PasswordExpiry = PasswordExpiry;
     x.Unregistered   = Unregistered;
     x.EmailValidated = EmailValidated;
     x.Blocked        = Blocked;
     x.UserValidated  = UserValidated;
     x.UserName       = this.UserProfile != null ? this.UserProfile.Uri : UserName;
 }