public override DbWorkUnit WorkUnitFor(object repo, DbWorkUnitType type = DbWorkUnitType.Read)
 {
     var sess = context.SessionFactory.OpenSession();
     var wu = new SimpleDbWorkUnit(sess, type);
     wu.Start += new DbWorkUnitHandler(wu_Start);
     wu.Finish += new DbWorkUnitHandler(wu_Finish);
     wu.OnStart();
     return wu;
 }
예제 #2
0
        public override DbWorkUnit WorkUnitFor(object repo, DbWorkUnitType type = DbWorkUnitType.Read)
        {
            var sess = context.SessionFactory.OpenSession();
            var wu   = new SimpleDbWorkUnit(sess, type);

            wu.Start  += new DbWorkUnitHandler(wu_Start);
            wu.Finish += new DbWorkUnitHandler(wu_Finish);
            wu.OnStart();
            return(wu);
        }
 public override DbWorkUnit WorkUnitFor(object repo, DbWorkUnitType type = DbWorkUnitType.Read)
 {
     if (!repositories.ContainsKey(repo)) throw new Exception("Object not found in the list");
     
     var sess = repositories[repo];
     var wu = new SimpleDbWorkUnit(sess, type);
     wu.Start += new DbWorkUnitHandler(wu_Start);
     wu.Finish += new DbWorkUnitHandler(wu_Finish);
     wu.OnStart();
     return wu;
 }
        public override DbWorkUnit WorkUnitFor(object repo, DbWorkUnitType type = DbWorkUnitType.Read)
        {
            if (!repositories.ContainsKey(repo))
            {
                throw new Exception("Object not found in the list");
            }

            var sess = repositories[repo];
            var wu   = new SimpleDbWorkUnit(sess, type);

            wu.Start  += new DbWorkUnitHandler(wu_Start);
            wu.Finish += new DbWorkUnitHandler(wu_Finish);
            wu.OnStart();
            return(wu);
        }