diff options
Diffstat (limited to 'OpenSim/Data/Base/BaseFieldMapper.cs')
-rw-r--r-- | OpenSim/Data/Base/BaseFieldMapper.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/OpenSim/Data/Base/BaseFieldMapper.cs b/OpenSim/Data/Base/BaseFieldMapper.cs index 4fdc7b9..c7d6bc9 100644 --- a/OpenSim/Data/Base/BaseFieldMapper.cs +++ b/OpenSim/Data/Base/BaseFieldMapper.cs | |||
@@ -34,11 +34,17 @@ namespace OpenSim.Data.Base | |||
34 | public delegate TField ObjectGetAccessor<TObj, TField>(TObj obj); | 34 | public delegate TField ObjectGetAccessor<TObj, TField>(TObj obj); |
35 | public delegate void ObjectSetAccessor<TObj, TField>(TObj obj, TField value); | 35 | public delegate void ObjectSetAccessor<TObj, TField>(TObj obj, TField value); |
36 | 36 | ||
37 | /// <summary> | ||
38 | /// | ||
39 | /// </summary> | ||
37 | public abstract class BaseFieldMapper | 40 | public abstract class BaseFieldMapper |
38 | { | 41 | { |
39 | private readonly BaseTableMapper m_tableMapper; | 42 | private readonly BaseTableMapper m_tableMapper; |
40 | private readonly string m_fieldName; | 43 | private readonly string m_fieldName; |
41 | 44 | ||
45 | /// <summary> | ||
46 | /// | ||
47 | /// </summary> | ||
42 | public string FieldName | 48 | public string FieldName |
43 | { | 49 | { |
44 | get { return m_fieldName; } | 50 | get { return m_fieldName; } |
@@ -46,6 +52,9 @@ namespace OpenSim.Data.Base | |||
46 | 52 | ||
47 | protected Type m_valueType; | 53 | protected Type m_valueType; |
48 | 54 | ||
55 | /// <summary> | ||
56 | /// | ||
57 | /// </summary> | ||
49 | public Type ValueType | 58 | public Type ValueType |
50 | { | 59 | { |
51 | get { return m_valueType; } | 60 | get { return m_valueType; } |
@@ -53,6 +62,12 @@ namespace OpenSim.Data.Base | |||
53 | 62 | ||
54 | public abstract object GetParamValue(object obj); | 63 | public abstract object GetParamValue(object obj); |
55 | 64 | ||
65 | /// <summary> | ||
66 | /// | ||
67 | /// </summary> | ||
68 | /// <param name="tableMapper"></param> | ||
69 | /// <param name="fieldName"></param> | ||
70 | /// <param name="valueType"></param> | ||
56 | public BaseFieldMapper(BaseTableMapper tableMapper, string fieldName, Type valueType) | 71 | public BaseFieldMapper(BaseTableMapper tableMapper, string fieldName, Type valueType) |
57 | { | 72 | { |
58 | m_fieldName = fieldName; | 73 | m_fieldName = fieldName; |
@@ -62,6 +77,13 @@ namespace OpenSim.Data.Base | |||
62 | 77 | ||
63 | public abstract void SetPropertyFromReader(object mapper, BaseDataReader reader); | 78 | public abstract void SetPropertyFromReader(object mapper, BaseDataReader reader); |
64 | 79 | ||
80 | /// <summary> | ||
81 | /// | ||
82 | /// </summary> | ||
83 | /// <param name="command"></param> | ||
84 | /// <param name="fieldNames"></param> | ||
85 | /// <param name="fieldName"></param> | ||
86 | /// <param name="value"></param> | ||
65 | public void RawAddParam(DbCommand command, List<string> fieldNames, string fieldName, object value) | 87 | public void RawAddParam(DbCommand command, List<string> fieldNames, string fieldName, object value) |
66 | { | 88 | { |
67 | string paramName = m_tableMapper.CreateParamName(fieldName); | 89 | string paramName = m_tableMapper.CreateParamName(fieldName); |
@@ -74,6 +96,13 @@ namespace OpenSim.Data.Base | |||
74 | command.Parameters.Add(param); | 96 | command.Parameters.Add(param); |
75 | } | 97 | } |
76 | 98 | ||
99 | /// <summary> | ||
100 | /// | ||
101 | /// </summary> | ||
102 | /// <typeparam name="TObj"></typeparam> | ||
103 | /// <param name="obj"></param> | ||
104 | /// <param name="command"></param> | ||
105 | /// <param name="fieldNames"></param> | ||
77 | public virtual void ExpandField<TObj>(TObj obj, DbCommand command, List<string> fieldNames) | 106 | public virtual void ExpandField<TObj>(TObj obj, DbCommand command, List<string> fieldNames) |
78 | { | 107 | { |
79 | string fieldName = FieldName; | 108 | string fieldName = FieldName; |
@@ -82,6 +111,11 @@ namespace OpenSim.Data.Base | |||
82 | RawAddParam(command, fieldNames, fieldName, m_tableMapper.ConvertToDbType(value)); | 111 | RawAddParam(command, fieldNames, fieldName, m_tableMapper.ConvertToDbType(value)); |
83 | } | 112 | } |
84 | 113 | ||
114 | /// <summary> | ||
115 | /// | ||
116 | /// </summary> | ||
117 | /// <param name="reader"></param> | ||
118 | /// <returns></returns> | ||
85 | protected virtual object GetValue(BaseDataReader reader) | 119 | protected virtual object GetValue(BaseDataReader reader) |
86 | { | 120 | { |
87 | object value; | 121 | object value; |
@@ -130,6 +164,11 @@ namespace OpenSim.Data.Base | |||
130 | } | 164 | } |
131 | } | 165 | } |
132 | 166 | ||
167 | /// <summary> | ||
168 | /// | ||
169 | /// </summary> | ||
170 | /// <typeparam name="TObject"></typeparam> | ||
171 | /// <typeparam name="TField"></typeparam> | ||
133 | public class ObjectField<TObject, TField> : BaseFieldMapper | 172 | public class ObjectField<TObject, TField> : BaseFieldMapper |
134 | { | 173 | { |
135 | private readonly ObjectGetAccessor<TObject, TField> m_fieldGetAccessor; | 174 | private readonly ObjectGetAccessor<TObject, TField> m_fieldGetAccessor; |
@@ -157,6 +196,13 @@ namespace OpenSim.Data.Base | |||
157 | } | 196 | } |
158 | 197 | ||
159 | 198 | ||
199 | /// <summary> | ||
200 | /// | ||
201 | /// </summary> | ||
202 | /// <param name="tableMapper"></param> | ||
203 | /// <param name="fieldName"></param> | ||
204 | /// <param name="rowMapperGetAccessor"></param> | ||
205 | /// <param name="rowMapperSetAccessor"></param> | ||
160 | public ObjectField(BaseTableMapper tableMapper, string fieldName, ObjectGetAccessor<TObject, TField> rowMapperGetAccessor, | 206 | public ObjectField(BaseTableMapper tableMapper, string fieldName, ObjectGetAccessor<TObject, TField> rowMapperGetAccessor, |
161 | ObjectSetAccessor<TObject, TField> rowMapperSetAccessor) | 207 | ObjectSetAccessor<TObject, TField> rowMapperSetAccessor) |
162 | : base(tableMapper, fieldName, typeof(TField)) | 208 | : base(tableMapper, fieldName, typeof(TField)) |