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)); }
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)); }
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); }