| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
TypeHandlers\ITypeHandlerCallback.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 Using | |
28 | ||
29 | using System.Data; | |
30 | using IBatisNet.DataMapper.Configuration.ParameterMapping; | |
31 | ||
32 | #endregion | |
33 | ||
34 | namespace IBatisNet.DataMapper.TypeHandlers | |
35 | { | |
36 | /// <summary> | |
37 | /// A simple interface for implementing custom type handlers. | |
38 | /// <p/> | |
39 | /// Using this interface, you can implement a type handler that | |
40 | /// will perform customized processing before parameters are set | |
41 | /// on a IDbCommand and after values are retrieved from | |
42 | /// a IDataReader. Using a custom type handler you can extend | |
43 | /// the framework to handle types that are not supported, or | |
44 | /// handle supported types in a different way. For example, | |
45 | /// you might use a custom type handler to implement proprietary | |
46 | /// BLOB support (e.g. Oracle), or you might use it to handle | |
47 | /// booleans using "Y" and "N" instead of the more typical 0/1. | |
48 | /// </summary> | |
49 | public interface ITypeHandlerCallback | |
50 | { | |
51 | /// <summary> | |
52 | /// Performs processing on a value before it is used to set | |
53 | /// the parameter of a IDbCommand. | |
54 | /// </summary> | |
55 | /// <param name="setter">The interface for setting the value on the IDbCommand.</param> | |
56 | /// <param name="parameter">The value to be set</param> | |
57 | void SetParameter(IParameterSetter setter, object parameter); | |
58 | ||
59 | ||
60 | /// <summary> | |
61 | /// Performs processing on a value before after it has been retrieved | |
62 | /// from a IDataReader. | |
63 | /// </summary> | |
64 | /// <param name="getter">The interface for getting the value from the IDataReader.</param> | |
65 | /// <returns>The processed value.</returns> | |
66 | object GetResult(IResultGetter getter); | |
67 | ||
68 | ||
69 | /// <summary> | |
70 | /// Casts the string representation of a value into a type recognized by | |
71 | /// this type handler. This method is used to translate nullValue values | |
72 | /// into types that can be appropriately compared. If your custom type handler | |
73 | /// cannot support nullValues, or if there is no reasonable string representation | |
74 | /// for this type (e.g. File type), you can simply return the String representation | |
75 | /// as it was passed in. It is not recommended to return null, unless null was passed | |
76 | /// in. | |
77 | /// </summary> | |
78 | /// <param name="s"></param> | |
79 | /// <returns></returns> | |
80 | object ValueOf(string s); | |
81 | } | |
82 | } | |
83 |
|