@@ -27,12 +27,12 @@ class SqlInMemoryTableSessionStateRepository : ISqlSessionStateRepository
2727 #region Sql statement
2828 // Most of the SQL statements should just work, the following statements are different
2929 #region CreateSessionTable
30- private static readonly string CreateSessionTableSql = $ @ "
30+ private const string CreateSessionTableSql = @"
3131 IF NOT EXISTS (SELECT *
3232 FROM INFORMATION_SCHEMA.TABLES
33- WHERE TABLE_NAME = '{ SqlSessionStateRepositoryUtil . TableName } ')
33+ WHERE TABLE_NAME = '" + SqlSessionStateRepositoryUtil . TableName + @" ')
3434 BEGIN
35- CREATE TABLE { SqlSessionStateRepositoryUtil . TableName } (
35+ CREATE TABLE " + SqlSessionStateRepositoryUtil . TableName + @" (
3636 SessionId nvarchar(88) COLLATE Latin1_General_100_BIN2 NOT NULL,
3737 Created datetime NOT NULL DEFAULT GETUTCDATE(),
3838 Expires datetime NOT NULL,
@@ -56,7 +56,7 @@ PRIMARY KEY NONCLUSTERED HASH
5656 #endregion
5757
5858 #region GetStateItemExclusive
59- private static readonly string GetStateItemExclusiveSql = $ @ "
59+ private const string GetStateItemExclusiveSql = @"
6060 DECLARE @textptr AS varbinary(max)
6161 DECLARE @length AS int
6262 DECLARE @now AS datetime
@@ -69,41 +69,41 @@ DECLARE @LockedCheck bit
6969 DECLARE @Flags int
7070
7171 SELECT @LockedCheck = Locked, @Flags = Flags
72- FROM { SqlSessionStateRepositoryUtil . TableName }
73- WHERE SessionID = @ { SqlParameterName . SessionId }
72+ FROM " + SqlSessionStateRepositoryUtil . TableName + @"
73+ WHERE SessionID = " + SqlParameterName . SessionId + @"
7474 IF @Flags&1 <> 0
7575 BEGIN
76- SET @actionFlags = 1
77- UPDATE { SqlSessionStateRepositoryUtil . TableName }
78- SET Flags = Flags & ~1 WHERE SessionID = @ { SqlParameterName . SessionId }
76+ SET " + SqlParameterName . ActionFlags + @" = 1
77+ UPDATE " + SqlSessionStateRepositoryUtil . TableName + @"
78+ SET Flags = Flags & ~1 WHERE SessionID = " + SqlParameterName . SessionId + @"
7979 END
8080 ELSE
81- SET @ { SqlParameterName . ActionFlags } = 0
81+ SET " + SqlParameterName . ActionFlags + @" = 0
8282
8383 IF @LockedCheck = 1
8484 BEGIN
85- UPDATE { SqlSessionStateRepositoryUtil . TableName }
85+ UPDATE " + SqlSessionStateRepositoryUtil . TableName + @"
8686 SET Expires = DATEADD(n, Timeout, @now),
87- @ { SqlParameterName . LockAge } = DATEDIFF(second, LockDate, @now),
88- @ { SqlParameterName . LockCookie } = LockCookie,
87+ " + SqlParameterName . LockAge + @" = DATEDIFF(second, LockDate, @now),
88+ " + SqlParameterName . LockCookie + @" = LockCookie,
8989 --@textptr = NULL,
9090 @length = NULL,
91- @ { SqlParameterName . Locked } = 1
92- WHERE SessionId = @ { SqlParameterName . SessionId }
91+ " + SqlParameterName . Locked + @" = 1
92+ WHERE SessionId = " + SqlParameterName . SessionId + @"
9393 END
9494 ELSE
9595 BEGIN
96- UPDATE { SqlSessionStateRepositoryUtil . TableName }
96+ UPDATE " + SqlSessionStateRepositoryUtil . TableName + @"
9797 SET Expires = DATEADD(n, Timeout, @now),
9898 LockDate = @now,
9999 LockDateLocal = @nowlocal,
100- @ { SqlParameterName . LockAge } = 0,
101- @ { SqlParameterName . LockCookie } = LockCookie = LockCookie + 1,
100+ " + SqlParameterName . LockAge + @" = 0,
101+ " + SqlParameterName . LockCookie + @" = LockCookie = LockCookie + 1,
102102 @textptr = SessionItemLong,
103103 @length = 1,
104- @ { SqlParameterName . Locked } = 0,
104+ " + SqlParameterName . Locked + @" = 0,
105105 Locked = 1
106- WHERE SessionId = @ { SqlParameterName . SessionId }
106+ WHERE SessionId = " + SqlParameterName . SessionId + @"
107107
108108 IF @TextPtr IS NOT NULL
109109 SELECT @TextPtr
@@ -112,22 +112,22 @@ SELECT @TextPtr
112112 #endregion
113113
114114 #region GetStateItem
115- private static readonly string GetStateItemSql = $ @ "
115+ private const string GetStateItemSql = @"
116116 DECLARE @textptr AS varbinary(max)
117117 DECLARE @length AS int
118118 DECLARE @now AS datetime
119119 SET @now = GETUTCDATE()
120120
121- UPDATE { SqlSessionStateRepositoryUtil . TableName }
121+ UPDATE " + SqlSessionStateRepositoryUtil . TableName + @"
122122 SET Expires = DATEADD(n, Timeout, @now),
123- @ { SqlParameterName . Locked } = Locked,
124- @ { SqlParameterName . LockAge } = DATEDIFF(second, LockDate, @now),
125- @ { SqlParameterName . LockCookie } = LockCookie,
126- @textptr = CASE @ { SqlParameterName . Locked }
123+ " + SqlParameterName . Locked + @" = Locked,
124+ " + SqlParameterName . LockAge + @" = DATEDIFF(second, LockDate, @now),
125+ " + SqlParameterName . LockCookie + @" = LockCookie,
126+ @textptr = CASE " + SqlParameterName . Locked + @"
127127 WHEN 0 THEN SessionItemLong
128128 ELSE NULL
129129 END,
130- @length = CASE @ { SqlParameterName . Locked }
130+ @length = CASE " + SqlParameterName . Locked + @"
131131 WHEN 0 THEN DATALENGTH(SessionItemLong)
132132 ELSE NULL
133133 END,
@@ -137,19 +137,19 @@ ELSE NULL
137137 WHEN (Flags & 1) <> 0 THEN (Flags & ~1)
138138 ELSE Flags
139139 END,
140- @ { SqlParameterName . ActionFlags } = CASE
140+ " + SqlParameterName . ActionFlags + @" = CASE
141141 WHEN (Flags & 1) <> 0 THEN 1
142142 ELSE 0
143143 END
144- WHERE SessionId = @ { SqlParameterName . SessionId }
144+ WHERE SessionId = " + SqlParameterName . SessionId + @"
145145 IF @length IS NOT NULL BEGIN
146146 SELECT @textptr
147147 END
148148 " ;
149149 #endregion
150150
151151 #region DeleteExpiredSessions
152- private static readonly string DeleteExpiredSessionsSql = $ @ "
152+ private const string DeleteExpiredSessionsSql = @"
153153 SET NOCOUNT ON
154154 SET DEADLOCK_PRIORITY LOW
155155
@@ -163,7 +163,7 @@ SessionId nvarchar({SqlSessionStateRepositoryUtil.IdLength}) NOT NULL PRIMARY KE
163163
164164 INSERT #tblExpiredSessions (SessionId)
165165 SELECT SessionId
166- FROM { SqlSessionStateRepositoryUtil . TableName } WITH (SNAPSHOT)
166+ FROM " + SqlSessionStateRepositoryUtil . TableName + @" WITH (SNAPSHOT)
167167 WHERE Expires < @now
168168
169169 IF @@ROWCOUNT <> 0
@@ -179,7 +179,7 @@ FETCH NEXT FROM ExpiredSessionCursor INTO @SessionId
179179
180180 WHILE @@FETCH_STATUS = 0
181181 BEGIN
182- DELETE FROM { SqlSessionStateRepositoryUtil . TableName } WHERE SessionId = @SessionId AND Expires < @now
182+ DELETE FROM " + SqlSessionStateRepositoryUtil . TableName + @" WHERE SessionId = @SessionId AND Expires < @now
183183 FETCH NEXT FROM ExpiredSessionCursor INTO @SessionId
184184 END
185185
@@ -193,13 +193,13 @@ DEALLOCATE ExpiredSessionCursor
193193 #endregion
194194
195195 #region TempInsertUninitializedItem
196- private static readonly string TempInsertUninitializedItemSql = $ @ "
196+ private const string TempInsertUninitializedItemSql = @"
197197 DECLARE @now AS datetime
198198 DECLARE @nowLocal AS datetime
199199 SET @now = GETUTCDATE()
200200 SET @nowLocal = GETDATE()
201201
202- INSERT { SqlSessionStateRepositoryUtil . TableName } (SessionId,
202+ INSERT " + SqlSessionStateRepositoryUtil . TableName + @" (SessionId,
203203 SessionItemLong,
204204 Timeout,
205205 Expires,
@@ -209,10 +209,10 @@ DECLARE @nowLocal AS datetime
209209 LockCookie,
210210 Flags)
211211 VALUES
212- (@ { SqlParameterName . SessionId } ,
213- @ { SqlParameterName . SessionItemLong } ,
214- @ { SqlParameterName . Timeout } ,
215- DATEADD(n, @ { SqlParameterName . Timeout } , @now),
212+ (" + SqlParameterName . SessionId + @" ,
213+ " + SqlParameterName . SessionItemLong + @" ,
214+ " + SqlParameterName . Timeout + @" ,
215+ DATEADD(n, " + SqlParameterName . Timeout + @" , @now),
216216 0,
217217 @now,
218218 @nowLocal,
@@ -221,45 +221,45 @@ DECLARE @nowLocal AS datetime
221221 #endregion
222222
223223 #region ReleaseItemExclusive
224- private static readonly string ReleaseItemExclusiveSql = $ @ "
225- UPDATE { SqlSessionStateRepositoryUtil . TableName }
224+ private const string ReleaseItemExclusiveSql = @"
225+ UPDATE " + SqlSessionStateRepositoryUtil . TableName + @"
226226 SET Expires = DATEADD(n, Timeout, GETUTCDATE()),
227227 Locked = 0
228- WHERE SessionId = @ { SqlParameterName . SessionId } AND LockCookie = @ { SqlParameterName . LockCookie } " ;
228+ WHERE SessionId = " + SqlParameterName . SessionId + @" AND LockCookie = " + SqlParameterName . LockCookie ;
229229 #endregion
230230
231231 #region RemoveStateItem
232- private static readonly string RemoveStateItemSql = $ @ "
233- DELETE { SqlSessionStateRepositoryUtil . TableName }
234- WHERE SessionId = @ { SqlParameterName . SessionId } AND LockCookie = @ { SqlParameterName . LockCookie } " ;
232+ private const string RemoveStateItemSql = @"
233+ DELETE " + SqlSessionStateRepositoryUtil . TableName + @"
234+ WHERE SessionId = " + SqlParameterName . SessionId + @" AND LockCookie = " + SqlParameterName . LockCookie ;
235235 #endregion
236236
237237 #region ResetItemTimeout
238- private static readonly string ResetItemTimeoutSql = $ @ "
239- UPDATE { SqlSessionStateRepositoryUtil . TableName }
238+ private const string ResetItemTimeoutSql = @"
239+ UPDATE " + SqlSessionStateRepositoryUtil . TableName + @"
240240 SET Expires = DATEADD(n, Timeout, GETUTCDATE())
241- WHERE SessionId = @ { SqlParameterName . SessionId } " ;
241+ WHERE SessionId = " + SqlParameterName . SessionId ;
242242 #endregion
243243
244244 #region UpdateStateItemLong
245- private static readonly string UpdateStateItemLongSql = $ @ "
246- UPDATE { SqlSessionStateRepositoryUtil . TableName }
247- SET Expires = DATEADD(n, @ { SqlParameterName . Timeout } , GETUTCDATE()),
248- SessionItemLong = @ { SqlParameterName . SessionItemLong } ,
249- Timeout = @ { SqlParameterName . Timeout } ,
245+ private const string UpdateStateItemLongSql = @"
246+ UPDATE " + SqlSessionStateRepositoryUtil . TableName + @"
247+ SET Expires = DATEADD(n, " + SqlParameterName . Timeout + @" , GETUTCDATE()),
248+ SessionItemLong = " + SqlParameterName . SessionItemLong + @" ,
249+ Timeout = " + SqlParameterName . Timeout + @" ,
250250 Locked = 0
251- WHERE SessionId = @ { SqlParameterName . SessionId } AND LockCookie = @ { SqlParameterName . LockCookie } " ;
251+ WHERE SessionId = " + SqlParameterName . SessionId + @" AND LockCookie = " + SqlParameterName . LockCookie ;
252252 #endregion
253253
254254 #region InsertStateItemLong
255- private static readonly string InsertStateItemLongSql = $ @ "
255+ private const string InsertStateItemLongSql = @"
256256 DECLARE @now AS datetime
257257 DECLARE @nowLocal AS datetime
258258
259259 SET @now = GETUTCDATE()
260260 SET @nowLocal = GETDATE()
261261
262- INSERT { SqlSessionStateRepositoryUtil . TableName }
262+ INSERT " + SqlSessionStateRepositoryUtil . TableName + @"
263263 (SessionId,
264264 SessionItemLong,
265265 Timeout,
@@ -269,10 +269,10 @@ DECLARE @nowLocal AS datetime
269269 LockDateLocal,
270270 LockCookie)
271271 VALUES
272- (@ { SqlParameterName . SessionId } ,
273- @ { SqlParameterName . SessionItemLong } ,
274- @ { SqlParameterName . Timeout } ,
275- DATEADD(n, @ { SqlParameterName . Timeout } , @now),
272+ (" + SqlParameterName . SessionId + @" ,
273+ " + SqlParameterName . SessionItemLong + @" ,
274+ " + SqlParameterName . Timeout + @" ,
275+ DATEADD(n, " + SqlParameterName . Timeout + @" , @now),
276276 0,
277277 @now,
278278 @nowLocal,
0 commit comments