public static T ExecuteInUoW <T>(Func <MiniSessionManager, T> func, MiniSessionManager mgr = null)
        {
            var prevManager = _manager;
            var manager     = mgr ?? new MiniSessionManager();

            Instance = manager;
            try
            {
                manager.OpenSessionWithTransaction();
                T result = func(manager);
                manager.Commit();
                return(result);
            }
            catch (Exception)
            {
                manager.Rollback();
                // This causes unhandled if called in a new thread!
                throw;
            }
            finally
            {
                if (mgr == null)
                {
                    manager.Dispose();
                }
                Instance = prevManager;
            }
        }
 public static void ExecuteInUoW(Action <MiniSessionManager> action, MiniSessionManager manager = null)
 {
     ExecuteInUoW <object>((mgr =>
     {
         action(mgr);
         return(null);
     }), manager);
 }
        public T AssociateGraphWithSession <T>(T entity, MiniSessionManager manager)
        {
            manager.Session.PrintGlobalStatistics();

            _parsedObjects = new List <object>();
            WalkAndReassociate(entity, manager.Session, entity.GetType().Name);

            manager.Session.PrintGlobalStatistics();
            return(entity);
        }
Esempio n. 4
0
 private static EntityInfo GetEntityInfo(MiniSessionManager manager, Domain.IDomainModelClass domainModelClass)