aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/TribalMedia/TribalMedia.Framework.Data/BaseFieldMapper.cs
diff options
context:
space:
mode:
authorlbsa712008-01-16 12:25:13 +0000
committerlbsa712008-01-16 12:25:13 +0000
commit5e757d2ad1ae3ad158a9b5f6077abcfaf9fac616 (patch)
tree96b3f4b939bd0c4a6e8b457f3e604ba143970c00 /ThirdParty/TribalMedia/TribalMedia.Framework.Data/BaseFieldMapper.cs
parent* Fix for: http://opensimulator.org/mantis/view.php?id=358 (diff)
downloadopensim-SC_OLD-5e757d2ad1ae3ad158a9b5f6077abcfaf9fac616.zip
opensim-SC_OLD-5e757d2ad1ae3ad158a9b5f6077abcfaf9fac616.tar.gz
opensim-SC_OLD-5e757d2ad1ae3ad158a9b5f6077abcfaf9fac616.tar.bz2
opensim-SC_OLD-5e757d2ad1ae3ad158a9b5f6077abcfaf9fac616.tar.xz
* More work on getting the database framework to actually work
Diffstat (limited to 'ThirdParty/TribalMedia/TribalMedia.Framework.Data/BaseFieldMapper.cs')
-rw-r--r--ThirdParty/TribalMedia/TribalMedia.Framework.Data/BaseFieldMapper.cs48
1 files changed, 4 insertions, 44 deletions
diff --git a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/BaseFieldMapper.cs b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/BaseFieldMapper.cs
index 20d8cf1..20f919a 100644
--- a/ThirdParty/TribalMedia/TribalMedia.Framework.Data/BaseFieldMapper.cs
+++ b/ThirdParty/TribalMedia/TribalMedia.Framework.Data/BaseFieldMapper.cs
@@ -29,10 +29,7 @@ using System.Collections.Generic;
29using System.Data.Common; 29using System.Data.Common;
30 30
31namespace TribalMedia.Framework.Data 31namespace TribalMedia.Framework.Data
32{ 32{
33 //public delegate TField RowMapperGetAccessor<TRowMapper, TField>(TRowMapper rowMapper);
34 //public delegate void RowMapperSetAccessor<TRowMapper, TField>(TRowMapper rowMapper, TField value);
35
36 public delegate TField ObjectGetAccessor<TObj, TField>(TObj obj); 33 public delegate TField ObjectGetAccessor<TObj, TField>(TObj obj);
37 public delegate void ObjectSetAccessor<TObj, TField>(TObj obj, TField value); 34 public delegate void ObjectSetAccessor<TObj, TField>(TObj obj, TField value);
38 35
@@ -62,7 +59,7 @@ namespace TribalMedia.Framework.Data
62 m_tableMapper = tableMapper; 59 m_tableMapper = tableMapper;
63 } 60 }
64 61
65 public abstract void SetPropertyFromReader(object mapper, DataReader reader); 62 public abstract void SetPropertyFromReader(object mapper, BaseDataReader reader);
66 63
67 public void RawAddParam(DbCommand command, List<string> fieldNames, string fieldName, object value) 64 public void RawAddParam(DbCommand command, List<string> fieldNames, string fieldName, object value)
68 { 65 {
@@ -84,7 +81,7 @@ namespace TribalMedia.Framework.Data
84 RawAddParam(command, fieldNames, fieldName, m_tableMapper.ConvertToDbType(value)); 81 RawAddParam(command, fieldNames, fieldName, m_tableMapper.ConvertToDbType(value));
85 } 82 }
86 83
87 protected virtual object GetValue(DataReader reader) 84 protected virtual object GetValue(BaseDataReader reader)
88 { 85 {
89 object value; 86 object value;
90 87
@@ -128,43 +125,6 @@ namespace TribalMedia.Framework.Data
128 } 125 }
129 } 126 }
130 127
131 //public class RowMapperField<TRowMapper, TField> : FieldMapper
132 // where TRowMapper : RowMapper
133 //{
134 // private readonly RowMapperGetAccessor<TRowMapper, TField> m_fieldGetAccessor;
135 // private readonly RowMapperSetAccessor<TRowMapper, TField> m_fieldSetAccessor;
136
137 // public override object GetParamValue(object obj)
138 // {
139 // return m_fieldGetAccessor((TRowMapper) obj);
140 // }
141
142 // public override void SetPropertyFromReader(object mapper, DataReader reader)
143 // {
144 // object value;
145
146 // value = GetValue(reader);
147
148 // if (value == null)
149 // {
150 // m_fieldSetAccessor((TRowMapper) mapper, default(TField));
151 // }
152 // else
153 // {
154 // m_fieldSetAccessor((TRowMapper) mapper, (TField) value);
155 // }
156 // }
157
158
159 // public RowMapperField(TableMapper tableMapper, string fieldName, RowMapperGetAccessor<TRowMapper, TField> rowMapperGetAccessor,
160 // RowMapperSetAccessor<TRowMapper, TField> rowMapperSetAccessor)
161 // : base(tableMapper, fieldName, typeof(TField))
162 // {
163 // m_fieldGetAccessor = rowMapperGetAccessor;
164 // m_fieldSetAccessor = rowMapperSetAccessor;
165 // }
166 //}
167
168 public class ObjectField<TObject, TField> : BaseFieldMapper 128 public class ObjectField<TObject, TField> : BaseFieldMapper
169 { 129 {
170 private readonly ObjectGetAccessor<TObject, TField> m_fieldGetAccessor; 130 private readonly ObjectGetAccessor<TObject, TField> m_fieldGetAccessor;
@@ -175,7 +135,7 @@ namespace TribalMedia.Framework.Data
175 return m_fieldGetAccessor((TObject)obj); 135 return m_fieldGetAccessor((TObject)obj);
176 } 136 }
177 137
178 public override void SetPropertyFromReader(object obj, DataReader reader) 138 public override void SetPropertyFromReader(object obj, BaseDataReader reader)
179 { 139 {
180 object value; 140 object value;
181 141