| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Configuration\Sql\Dynamic\Handlers\BaseTagHandler.cs | 87.5 % | 72.7 % | 75.0 % | 78.3 % |
|
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 | using System.Text; | |
30 | ||
31 | using IBatisNet.DataMapper.Configuration.Sql.Dynamic.Elements; | |
32 | #endregion | |
33 | ||
34 | namespace IBatisNet.DataMapper.Configuration.Sql.Dynamic.Handlers | |
35 | { | |
36 | /// <summary> | |
37 | /// Description résumée de BaseTagHandler. | |
38 | /// </summary> | |
39 | public abstract class BaseTagHandler : ISqlTagHandler | |
40 | { | |
41 | ||
42 | #region Const | |
43 | /// <summary> | |
44 | /// BODY TAG | |
45 | /// </summary> | |
46 | public const int SKIP_BODY = 0; | |
47 | /// <summary> | |
48 | /// | |
49 | /// </summary> | |
50 | public const int INCLUDE_BODY = 1; | |
51 | /// <summary> | |
52 | /// | |
53 | /// </summary> | |
54 | public const int REPEAT_BODY = 2; | |
55 | #endregion | |
56 | ||
57 | #region Methods | |
58 | /// <summary> | |
59 | /// | |
60 | /// </summary> | |
61 | /// <param name="ctx"></param> | |
62 | /// <param name="tag"></param> | |
63 | /// <param name="parameterObject"></param> | |
64 | /// <returns></returns> | |
65 | 0 | public virtual int DoStartFragment(SqlTagContext ctx, SqlTag tag, object parameterObject) |
66 | { | |
67 | return BaseTagHandler.INCLUDE_BODY; | |
68 | } | |
69 | ||
70 | /// <summary> | |
71 | /// | |
72 | /// </summary> | |
73 | /// <param name="ctx"></param> | |
74 | /// <param name="tag"></param> | |
75 | /// <param name="parameterObject"></param> | |
76 | /// <param name="bodyContent"></param> | |
77 | /// <returns></returns> | |
78 | 27 | public virtual int DoEndFragment(SqlTagContext ctx, SqlTag tag, object parameterObject, StringBuilder bodyContent) |
79 | { | |
80 | 27 | return BaseTagHandler.INCLUDE_BODY; |
81 | } | |
82 | ||
83 | /// <summary> | |
84 | /// | |
85 | /// </summary> | |
86 | /// <param name="ctx"></param> | |
87 | /// <param name="tag"></param> | |
88 | /// <param name="parameterObject"></param> | |
89 | /// <param name="bodyContent"></param> | |
90 | 89 | public virtual void DoPrepend(SqlTagContext ctx, SqlTag tag, object parameterObject, StringBuilder bodyContent) |
91 | { | |
92 | 89 | if (tag.IsPrependAvailable) |
93 | { | |
94 | 63 | if (bodyContent.ToString().Trim().Length > 0) |
95 | { | |
96 | 59 | if (ctx.IsOverridePrepend && tag == ctx.FirstNonDynamicTagWithPrepend) |
97 | { | |
98 | 20 | ctx.IsOverridePrepend = false; |
99 | } | |
100 | else | |
101 | { | |
102 | 39 | bodyContent.Insert(0, tag.Prepend); |
103 | } | |
104 | } | |
105 | else | |
106 | { | |
107 | 4 | if (ctx.FirstNonDynamicTagWithPrepend != null) |
108 | { | |
109 | 0 | ctx.FirstNonDynamicTagWithPrepend = null; |
110 | 0 | ctx.IsOverridePrepend =true; |
111 | } | |
112 | } | |
113 | } | |
114 | } | |
115 | ||
116 | ||
117 | #region ISqlTagHandler Menbers | |
118 | ||
119 | /// <summary> | |
120 | /// | |
121 | /// </summary> | |
122 | public virtual bool IsPostParseRequired | |
123 | { | |
124 | 9427 | get |
125 | { | |
126 | 9427 | return false; |
127 | } | |
128 | } | |
129 | ||
130 | ||
131 | #endregion | |
132 | #endregion | |
133 | ||
134 | } | |
135 | } | |
136 |
|