Ejemplo n.º 1
0
        /// <summary>
        /// Gets the protocol session.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <returns></returns>
        private ProtocolSession getProtocolSession(Session session)
        {
            var result = session.FindObject <ProtocolSession>(PersistentCriteriaEvaluationBehavior.InTransaction,
                                                              CriteriaOperator.Parse("SessionId = ?", SessionId));

            if (result == null)
            {
                result = new ProtocolSession(session)
                {
                    SessionId = SessionId, StartedOn = StartedOn, CommitedOn = CommitedOn
                };
                if (Parent != null)
                {
                    result.Parent = Parent.getProtocolSession(session);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the protocol session.
 /// </summary>
 /// <param name="session">The session.</param>
 /// <returns></returns>
 private ProtocolSession getProtocolSession(Session session)
 {
     var result = session.FindObject<ProtocolSession>(PersistentCriteriaEvaluationBehavior.InTransaction,
                                                      CriteriaOperator.Parse("SessionId = ?", SessionId));
     if(result == null)
     {
         result = new ProtocolSession(session) { SessionId = SessionId, StartedOn = StartedOn, CommitedOn = CommitedOn };
         if (Parent != null)
             result.Parent = Parent.getProtocolSession(session);
     }
     return result;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates PackageSession for protocol session.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="protocolSession">The protocol session.</param>
        /// <param name="nodeId"></param>
        /// <returns>Package session</returns>
        public static PackageSession CreateForProtocolSession(Session session, ProtocolSession protocolSession, string nodeId)
        {
            var result = session.FindObject<PackageSession>(PersistentCriteriaEvaluationBehavior.InTransaction,
                CriteriaOperator.Parse("SessionId = ?", protocolSession.SessionId));

            if (result == null)
            {

                result = new PackageSession(session)
                             {
                                 SessionId = protocolSession.SessionId,
                                 StartedOn = protocolSession.StartedOn,
                                 CommitedOn = protocolSession.CommitedOn
                             };

                if (protocolSession is ExternalProtocolSession)
                    result.Route = ((ExternalProtocolSession) protocolSession).Route;

                result.Route += '\n' + nodeId;

                if (protocolSession.Parent != null)
                    result.Parent = CreateForProtocolSession(session, protocolSession.Parent, nodeId);
            }

            return result;
        }
 public static BuildSessionInfo GetInstance(ReplicationNode targetNode, ProtocolSession protocolSession)
 {
     List<BuildSessionInfo> list;
     if (!PacketTargets.TryGetValue(targetNode, out list))
     {
         list = new List<BuildSessionInfo>();
         PacketTargets.Add(targetNode, list);
     }
     var result = (from c in list where ReferenceEquals(c.ProtocolSession, protocolSession) select c).FirstOrDefault();
     if (result == null)
     {
         result = new BuildSessionInfo(targetNode, protocolSession);
         list.Add(result);
         if (protocolSession.Parent != null)
             result.parent = GetInstance(targetNode, protocolSession.Parent);
     }
     return result;
 }
 private BuildSessionInfo(ReplicationNode targetNode, ProtocolSession protocolSession)
 {
     TargetNode = targetNode;
     ProtocolSession = protocolSession;
     ProtocolRecords = new List<ProtocolRecord>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SaveProtocolSessionParams"/> class.
 /// </summary>
 /// <param name="baseParams">The base params.</param>
 /// <param name="protocolSession">The protocol session.</param>
 public SaveProtocolSessionParams(SaveProtocolParams baseParams, ProtocolSession protocolSession)
     : base(baseParams)
 {
     ProtocolSession = protocolSession;
 }