@@ -34,9 +34,7 @@ public class CouchbaseSessionStateProvider : SessionStateStoreProviderBase
34
34
/// </summary>
35
35
/// <param name="name">Name of the element in the configuration file</param>
36
36
/// <param name="config">Configuration values for the provider from the Web.config file</param>
37
- public override void Initialize (
38
- string name ,
39
- NameValueCollection config )
37
+ public override void Initialize ( string name , NameValueCollection config )
40
38
{
41
39
// Initialize the base class
42
40
base . Initialize ( name , config ) ;
@@ -53,11 +51,13 @@ public override void Initialize(
53
51
54
52
// Allow optional header and data prefixes to be used for this application
55
53
var headerPrefix = ProviderHelper . GetAndRemove ( config , "headerPrefix" , false ) ;
56
- if ( headerPrefix != null ) {
54
+ if ( headerPrefix != null )
55
+ {
57
56
HeaderPrefix = headerPrefix ;
58
57
}
59
58
var dataPrefix = ProviderHelper . GetAndRemove ( config , "dataPrefix" , false ) ;
60
- if ( dataPrefix != null ) {
59
+ if ( dataPrefix != null )
60
+ {
61
61
DataPrefix = dataPrefix ;
62
62
}
63
63
@@ -70,7 +70,8 @@ public override void Initialize(
70
70
/// </summary>
71
71
public override void Dispose ( )
72
72
{
73
- if ( _cluster != null ) {
73
+ if ( _cluster != null )
74
+ {
74
75
_cluster . Dispose ( ) ;
75
76
_cluster = null ;
76
77
}
@@ -81,8 +82,7 @@ public override void Dispose()
81
82
/// initialization required by the session-state store provider.
82
83
/// </summary>
83
84
/// <param name="context">HttpContext for the current request</param>
84
- public override void InitializeRequest (
85
- HttpContext context )
85
+ public override void InitializeRequest ( HttpContext context )
86
86
{
87
87
}
88
88
@@ -91,8 +91,7 @@ public override void InitializeRequest(
91
91
/// cleanup required by the session-state store provider.
92
92
/// </summary>
93
93
/// <param name="context">HttpContext for the current request</param>
94
- public override void EndRequest (
95
- HttpContext context )
94
+ public override void EndRequest ( HttpContext context )
96
95
{
97
96
}
98
97
@@ -106,9 +105,7 @@ public override void EndRequest(
106
105
/// <param name="context">HttpContext for the current request</param>
107
106
/// <param name="timeout">Timeout value for the session</param>
108
107
/// <returns>New SessionStateStoreData object for storing the session state data</returns>
109
- public override SessionStateStoreData CreateNewStoreData (
110
- HttpContext context ,
111
- int timeout )
108
+ public override SessionStateStoreData CreateNewStoreData ( HttpContext context , int timeout )
112
109
{
113
110
return new SessionStateStoreData ( new SessionStateItemCollection ( ) ,
114
111
SessionStateUtility . GetSessionStaticObjects ( context ) ,
@@ -123,12 +120,10 @@ public override SessionStateStoreData CreateNewStoreData(
123
120
/// <param name="context">HttpContext for the current request</param>
124
121
/// <param name="id">Session ID for the new session</param>
125
122
/// <param name="timeout">Timeout value for the session</param>
126
- public override void CreateUninitializedItem (
127
- HttpContext context ,
128
- string id ,
129
- int timeout )
123
+ public override void CreateUninitializedItem ( HttpContext context , string id , int timeout )
130
124
{
131
- var e = new SessionStateItem {
125
+ var e = new SessionStateItem
126
+ {
132
127
Data = new SessionStateItemCollection ( ) ,
133
128
Flag = SessionStateActions . InitializeItem ,
134
129
LockId = 0 ,
@@ -215,12 +210,14 @@ public static SessionStateItem GetSessionStoreItem(
215
210
if ( e == null )
216
211
return null ;
217
212
218
- if ( acquireLock ) {
213
+ if ( acquireLock )
214
+ {
219
215
// repeat until we can update the retrieved
220
216
// item (i.e. nobody changes it between the
221
217
// time we get it from the store and updates it s attributes)
222
218
// Save() will return false if Cas() fails
223
- while ( true ) {
219
+ while ( true )
220
+ {
224
221
if ( e . LockId > 0 )
225
222
break ;
226
223
@@ -272,7 +269,8 @@ public override void SetAndReleaseItemExclusive(
272
269
{
273
270
SessionStateItem e ;
274
271
do {
275
- if ( ! newItem ) {
272
+ if ( ! newItem )
273
+ {
276
274
var tmp = ( ulong ) lockId ;
277
275
278
276
// Load the entire item with CAS (need the DataCas value also for the save)
@@ -281,10 +279,13 @@ public override void SetAndReleaseItemExclusive(
281
279
// if we're expecting an existing item, but
282
280
// it's not in the cache
283
281
// or it's locked by someone else, then quit
284
- if ( e == null || e . LockId != tmp ) {
282
+ if ( e == null || e . LockId != tmp )
283
+ {
285
284
return ;
286
285
}
287
- } else {
286
+ }
287
+ else
288
+ {
288
289
// Create a new item if it requested
289
290
e = new SessionStateItem ( ) ;
290
291
}
@@ -318,7 +319,8 @@ public override void ReleaseItemExclusive(
318
319
e = SessionStateItem . Load ( _bucket , id , true ) ;
319
320
320
321
// Bail if the entry does not exist, or the lock ID does not match our lock ID
321
- if ( e == null || e . LockId != tmp ) {
322
+ if ( e == null || e . LockId != tmp )
323
+ {
322
324
break ;
323
325
}
324
326
@@ -344,7 +346,8 @@ public override void RemoveItem(
344
346
var tmp = ( ulong ) lockId ;
345
347
var e = SessionStateItem . Load ( _bucket , id , true ) ;
346
348
347
- if ( e != null && e . LockId == tmp ) {
349
+ if ( e != null && e . LockId == tmp )
350
+ {
348
351
SessionStateItem . Remove ( _bucket , id ) ;
349
352
}
350
353
}
@@ -362,7 +365,8 @@ public override void ResetItemTimeout(
362
365
do {
363
366
// Load the item with CAS
364
367
e = SessionStateItem . Load ( _bucket , id , false ) ;
365
- if ( e == null ) {
368
+ if ( e == null )
369
+ {
366
370
break ;
367
371
}
368
372
@@ -376,8 +380,7 @@ public override void ResetItemTimeout(
376
380
/// </summary>
377
381
/// <param name="expireCallback">Session expiration callback to set</param>
378
382
/// <returns>False, since we don't support this feature</returns>
379
- public override bool SetItemExpireCallback (
380
- SessionStateItemExpireCallback expireCallback )
383
+ public override bool SetItemExpireCallback ( SessionStateItemExpireCallback expireCallback )
381
384
{
382
385
return false ;
383
386
}
0 commit comments