Exemple #1
0
        public static void ExecuteInUoW(Action <MiniSessionService> action)
        {
            var factory = ServiceLocator.Current.GetInstance <ISessionFactory>();

            using (var manager = new MiniSessionService(factory))
            {
                action(manager);
            }
        }
Exemple #2
0
        public static T ExecuteInUoW <T>(Func <MiniSessionService, T> action)
        {
            var factory = ServiceLocator.Current.GetInstance <ISessionFactory>();

            using (var manager = new MiniSessionService(factory))
            {
                return(action(manager));
            }
        }
 public static void ExecuteInUoW(Action <MiniSessionService> action, ISessionFactory factory = null)
 {
     factory = factory ?? ServiceLocator.Current.GetInstance <ISessionFactory>();
     using (var manager = new MiniSessionService(factory))
     {
         manager.OpenSessionWithTransaction();
         UoWContext.Push(manager);
         action(manager);
         UoWContext.Pop();
         manager.CommitChanges();
     }
 }
        public static T ExecuteInUoW <T>(Func <MiniSessionService, T> action)
        {
            var factory = ServiceLocator.Current.GetInstance <ISessionFactory>();

            using (var manager = new MiniSessionService(factory))
            {
                manager.OpenSessionWithTransaction();
                UoWContext.Push(manager);
                var result = action(manager);
                UoWContext.Pop();
                manager.CommitChanges();
                return(result);
            }
        }