| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
SessionContainer\WindowSessionContainer.cs | - | 100.0 % | 100.0 % | 100.0 % |
|
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 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
12 | * you may not use this file except in compliance with the License. | |
13 | * You may obtain a copy of the License at | |
14 | * | |
15 | * http://www.apache.org/licenses/LICENSE-2.0 | |
16 | * | |
17 | * Unless required by applicable law or agreed to in writing, software | |
18 | * distributed under the License is distributed on an "AS IS" BASIS, | |
19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
20 | * See the License for the specific language governing permissions and | |
21 | * limitations under the License. | |
22 | * | |
23 | ********************************************************************************/ | |
24 | #endregion | |
25 | ||
26 | #region Imports | |
27 | using System; | |
28 | #endregion | |
29 | ||
30 | namespace IBatisNet.DataMapper.SessionContainer | |
31 | { | |
32 | /// <summary> | |
33 | /// Session container for windows/console application. | |
34 | /// </summary> | |
35 | public class WindowSessionContainer : ISessionContainer | |
36 | { | |
37 | #region Fields | |
38 | [ThreadStatic] | |
39 | private SqlMapSession _localSqlMapSession = null; | |
40 | #endregion | |
41 | ||
42 | #region ISessionContainer Members | |
43 | ||
44 | #region Properties | |
45 | /// <summary> | |
46 | /// Get the local session | |
47 | /// </summary> | |
48 | public SqlMapSession LocalSession | |
49 | { | |
50 | 316 | get |
51 | { | |
52 | 316 | return _localSqlMapSession; |
53 | } | |
54 | } | |
55 | #endregion | |
56 | ||
57 | #region Methods | |
58 | /// <summary> | |
59 | /// Store the local session on the container. | |
60 | /// Ensure that the session is unique for each thread. | |
61 | /// </summary> | |
62 | /// <param name="session">The session to store</param> | |
63 | 5 | public void Store(SqlMapSession session) |
64 | { | |
65 | 5 | _localSqlMapSession = session; |
66 | } | |
67 | ||
68 | /// <summary> | |
69 | /// Remove the local session from the container. | |
70 | /// </summary> | |
71 | 5 | public void Dispose() |
72 | { | |
73 | 5 | _localSqlMapSession = null; |
74 | } | |
75 | #endregion | |
76 | ||
77 | #endregion | |
78 | } | |
79 | } | |
80 |
|