| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Configuration\Sql\Dynamic\Handlers\IsNullTagHandler.cs | 100.0 % | 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 | * | |
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 | using System; | |
28 | ||
29 | using IBatisNet.DataMapper.Configuration.Sql.Dynamic.Elements; | |
30 | using IBatisNet.Common.Utilities.Objects; | |
31 | ||
32 | namespace IBatisNet.DataMapper.Configuration.Sql.Dynamic.Handlers | |
33 | { | |
34 | /// <summary> | |
35 | /// Summary description for IsNullTagHandler. | |
36 | /// </summary> | |
37 | public class IsNullTagHandler : ConditionalTagHandler | |
38 | { | |
39 | /// <summary> | |
40 | /// | |
41 | /// </summary> | |
42 | /// <param name="ctx"></param> | |
43 | /// <param name="tag"></param> | |
44 | /// <param name="parameterObject"></param> | |
45 | /// <returns></returns> | |
46 | 14 | public override bool IsCondition(SqlTagContext ctx, SqlTag tag, object parameterObject) |
47 | { | |
48 | 14 | if (parameterObject == null) |
49 | { | |
50 | 1 | return true; |
51 | } | |
52 | else | |
53 | { | |
54 | 13 | string propertyName = ((BaseTag)tag).Property; |
55 | 13 | object value; |
56 | 13 | if (propertyName != null && propertyName.Length>0 ) |
57 | { | |
58 | 12 | value = ObjectProbe.GetPropertyValue(parameterObject, propertyName); |
59 | } | |
60 | else | |
61 | { | |
62 | 1 | value = parameterObject; |
63 | } | |
64 | 13 | return (value == null); |
65 | } | |
66 | } | |
67 | } | |
68 | } | |
69 |
|