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 (session == null) session = context.SessionFactory.OpenSession();
     else if(!session.IsOpen)
     {
         session.Dispose();
         session = context.SessionFactory.OpenSession();
     }
     
     return new SimpleDbWorkUnit(session, type);
 }
 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 (session == null)
            {
                session = context.SessionFactory.OpenSession();
            }
            else if (!session.IsOpen)
            {
                session.Dispose();
                session = context.SessionFactory.OpenSession();
            }

            return(new SimpleDbWorkUnit(session, type));
        }
        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 DbWorkUnit WorkUnitFor(object repo, DbWorkUnitType type)
 {
     var unit = _parent.WorkUnitFor(repo, type);
     switch (type)
     {
         case DbWorkUnitType.Write:
             _trackableContext.FreqWrite.Notify();
             break;
         case DbWorkUnitType.Read:
         default:
             _trackableContext.FreqRead.Notify();
             break;
     }
     return unit;
 }
        public DbWorkUnit WorkUnitFor(object repo, DbWorkUnitType type)
        {
            var unit = _parent.WorkUnitFor(repo, type);

            switch (type)
            {
            case DbWorkUnitType.Write:
                _trackableContext.FreqWrite.Notify();
                break;

            case DbWorkUnitType.Read:
            default:
                _trackableContext.FreqRead.Notify();
                break;
            }
            return(unit);
        }
 public SimpleDbWorkUnit(ISession session, DbWorkUnitType type)
     : base(type)
 {
     this.session = session;
 }
 public abstract DbWorkUnit WorkUnitFor(object repo, DbWorkUnitType type = DbWorkUnitType.Read);
 public abstract DbWorkUnit WorkUnitFor(object repo, DbWorkUnitType type = DbWorkUnitType.Read);
Пример #12
0
 protected DbWorkUnit GetSessionFor(DbWorkUnitType type = DbWorkUnitType.Read)
 {
     return(_context.SessionManager.WorkUnitFor(_repo, type));
 }
Пример #13
0
 public DbWorkUnit(DbWorkUnitType type = DbWorkUnitType.Read)
 {
     this.Type = type;
 }
 public SimpleDbWorkUnit(ISession session, DbWorkUnitType type)
     : base(type)
 {
     this.session = session;
 }
Пример #15
0
 public DbWorkUnit(DbWorkUnitType type = DbWorkUnitType.Read) 
 {
     this.Type = type;
 }