Пример #1
0
 private void InsertItem(SqlSessionId sessionId, byte[] data)
 {
     SqlProcedure.Create(_connectionString, SqlSession.IsShortData(data) ?
                         "TempInsertStateItemShort" :
                         "TempInsertStateItemLong").
     Execute(x => x.In("id", sessionId.ToString()),
             x => x.In(SqlSession.IsShortData(data) ? "itemShort" : "itemLong", data),
             x => x.In("timeout", _timeout));
 }
Пример #2
0
 private void UpdateItem(SqlSessionId sessionId, byte[] data, int lockCookie)
 {
     SqlProcedure.Create(_connectionString, SqlSession.IsShortData(data) ?
                         "TempUpdateStateItemShortNullLong" :
                         "TempUpdateStateItemLongNullShort").
     Execute(x => x.In("id", sessionId.ToString()),
             x => x.In(SqlSession.IsShortData(data) ? "itemShort" : "itemLong", data),
             x => x.In("timeout", _timeout),
             x => x.In("lockCookie", lockCookie));
 }
Пример #3
0
        private SqlSession GetSessionData(SqlSessionId sessionId)
        {
            var session = new SqlSession {
                Id = sessionId
            };

            SqlProcedure.Create(_connectionString, "TempGetStateItem3").
            Execute(x => session.Data = x.Read() ? (byte[])x[0] : session.Data,
                    x => x.In("id", sessionId.ToString()),
                    x => x.Out <byte[]>("itemShort", SqlDbType.VarBinary, 7000, y => session.Data = y),
                    x => x.Out <bool?>("locked", SqlDbType.Bit, y => session.Locked          = y.GetValueOrDefault()),
                    x => x.Out <int?>("lockAge", SqlDbType.Int, y => session.LockAge         = y.GetValueOrDefault()),
                    x => x.Out <int?>("lockCookie", SqlDbType.Int, y => session.LockCookie   = y.GetValueOrDefault()),
                    x => x.Out <int?>("actionFlags", SqlDbType.Int, y => session.ActionFlags = y.GetValueOrDefault()));
            return(session);
        }
Пример #4
0
 private void ReleaseSessionLock(SqlSession session)
 {
     SqlProcedure.Create(_connectionString, "TempReleaseStateItemExclusive").
     Execute(x => x.In("id", session.Id.ToString()),
             x => x.In("lockCookie", session.LockCookie));
 }
Пример #5
0
 private void AbandonSession(SqlSession session)
 {
     SqlProcedure.Create(_connectionString, "TempRemoveStateItem").
     Execute(x => x.In("id", session.Id.ToString()),
             x => x.In("lockCookie", session.LockCookie));
 }