| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
SessionContainer\ISessionContainer.cs | - | - | - | - |
|
1 | ||
2 | #region Apache Notice | |
3 | /***************************************************************************** | |
4 | * $Header: $ | |
5 | * $Revision: $ | |
6 | * $Date: $ | |
7 | * | |
8 | * iBATIS.NET Data Mapper | |
9 | * Copyright (C) 2004 - Gilles Bayon | |
10 | * | |
11 | * | |
12 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
13 | * you may not use this file except in compliance with the License. | |
14 | * You may obtain a copy of the License at | |
15 | * | |
16 | * http://www.apache.org/licenses/LICENSE-2.0 | |
17 | * | |
18 | * Unless required by applicable law or agreed to in writing, software | |
19 | * distributed under the License is distributed on an "AS IS" BASIS, | |
20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
21 | * See the License for the specific language governing permissions and | |
22 | * limitations under the License. | |
23 | * | |
24 | ********************************************************************************/ | |
25 | #endregion | |
26 | ||
27 | #region Imports | |
28 | using System; | |
29 | ||
30 | using IBatisNet.Common; | |
31 | #endregion | |
32 | ||
33 | namespace IBatisNet.DataMapper.SessionContainer | |
34 | { | |
35 | /// <summary> | |
36 | /// Definition for session container. | |
37 | /// </summary> | |
38 | public interface ISessionContainer | |
39 | { | |
40 | #region Doc ThreadStatic | |
41 | //http://www.joecheng.com/blog/entries/Thread-localstorageinJava.html | |
42 | //http://www.hanselman.com/blog/PermaLink.aspx?guid=320 | |
43 | //http://www.stud.ntnu.no/~wathne/files/JavaDotNetThreading.pdf | |
44 | //http://weblogs.asp.net/yreynhout/posts/4061.aspx | |
45 | //http://discuss.develop.com/archives/wa.exe?A2=ind0107C&L=DOTNET&P=R6756 | |
46 | /* | |
47 | * Don't slap a [ThreadStatic] attribute on a static member when you're operating | |
48 | * within ASP.NET as chances are you don't control the thread life...you inherit a worker thread. | |
49 | * ThreadStatic gives you thread local storage, not HttpContext local storage! | |
50 | * If you need to store something away to be used later in the same HTTP request, | |
51 | * think about my favorite ASP.NET class, the little-known and not-used-enough | |
52 | * System.Web.HttpContext.Current.Items (aside: great article by Susan Warren on Context). | |
53 | * In ASP.NET your code is run on a WorkerThread from the 25 or so threads | |
54 | * in the default ASP.NET worker thread pool and the variable that you think | |
55 | * is "personal private to your thread" is personal private...to you and every | |
56 | * other request that this worker thread has been with. Under load you may | |
57 | * well find your variable modified.[Scott Hanselman] | |
58 | ||
59 | * | |
60 | */ | |
61 | #endregion | |
62 | ||
63 | #region Properties | |
64 | /// <summary> | |
65 | /// Get the local session | |
66 | /// </summary> | |
67 | SqlMapSession LocalSession | |
68 | { | |
69 | get; | |
70 | } | |
71 | #endregion | |
72 | ||
73 | #region Methods | |
74 | /// <summary> | |
75 | /// Store the local session on the container. | |
76 | /// Ensure that the session is unique for each thread. | |
77 | /// </summary> | |
78 | /// <param name="session">The session to store</param> | |
79 | void Store(SqlMapSession session); | |
80 | ||
81 | /// <summary> | |
82 | /// Remove the local session from the container. | |
83 | /// </summary> | |
84 | void Dispose(); | |
85 | #endregion | |
86 | ||
87 | } | |
88 | } | |
89 |
|