0
|
1 <?xml version="1.0" encoding="utf-8"?>
|
|
2 <code transformer="Convert.xslt">
|
|
3
|
|
4 <<<<<<<<<<<<<<< This crap should not be used anymore.
|
|
5
|
|
6
|
|
7 <using namespace="System"/>
|
|
8 <using namespace="System.Data.SqlTypes"/>
|
|
9 <using namespace="System.Data.Linq"/>
|
|
10 <using namespace="System.Globalization"/>
|
|
11 <using namespace="System.IO"/>
|
|
12 <using namespace="System.Xml"/>
|
|
13 <br/>
|
|
14 <using namespace="BLToolkit.Properties"/>
|
|
15
|
|
16 <type name="SByte" clscompliant="false"/>
|
|
17 <type name="UInt16" clscompliant="false"/>
|
|
18 <type name="UInt32" clscompliant="false"/>
|
|
19 <type name="UInt64" clscompliant="false"/>
|
|
20
|
|
21 <type name="DateTimeOffset" condition="FW3"/>
|
|
22 <type name="Binary" condition="FW3"/>
|
|
23
|
|
24 <template name="Integer Types">
|
|
25 <type name="SByte" />
|
|
26 <type name="Int16" />
|
|
27 <type name="Int32" />
|
|
28 <type name="Int64" />
|
|
29 <br/>
|
|
30 <type name="Byte" />
|
|
31 <type name="UInt16" />
|
|
32 <type name="UInt32" />
|
|
33 <type name="UInt64" />
|
|
34 </template>
|
|
35
|
|
36 <template name="Numeric Types">
|
|
37 <include template="Integer Types"/>
|
|
38 <br/>
|
|
39 <type name="Single" />
|
|
40 <type name="Double" />
|
|
41 <br/>
|
|
42 <type name="Boolean" />
|
|
43 <type name="Decimal" />
|
|
44 </template>
|
|
45
|
|
46 <template name="SqlTypes">
|
|
47 <type name="SqlString"/>
|
|
48 <br/>
|
|
49 <type name="SqlByte"/>
|
|
50 <type name="SqlInt16"/>
|
|
51 <type name="SqlInt32"/>
|
|
52 <type name="SqlInt64"/>
|
|
53 <br/>
|
|
54 <type name="SqlSingle"/>
|
|
55 <type name="SqlDouble"/>
|
|
56 <type name="SqlDecimal"/>
|
|
57 <type name="SqlMoney"/>
|
|
58 <br/>
|
|
59 <type name="SqlBoolean"/>
|
|
60 </template>
|
|
61
|
|
62 <region name="Scalar Types">
|
|
63 <converter type="String">
|
|
64 <group name="Scalar Types.">
|
|
65 <include template ="Numeric Types"/>
|
|
66 <from type="Char"/>
|
|
67 <from type="TimeSpan"/>
|
|
68 <from type="DateTime"/>
|
|
69 <from type="DateTimeOffset"/>
|
|
70 <from type="Guid"/>
|
|
71 <default >return p.ToString();</default>
|
|
72 </group>
|
|
73 <group name="Nullable Types." nullable="true">
|
|
74 <include template ="Numeric Types"/>
|
|
75 <from type="Char"/>
|
|
76 <from type="TimeSpan"/>
|
|
77 <from type="DateTime"/>
|
|
78 <from type="DateTimeOffset"/>
|
|
79 <from type="Guid"/>
|
|
80 <default >return p.ToString();</default>
|
|
81 </group>
|
|
82 <group name="SqlTypes">
|
|
83 <include template ="SqlTypes"/>
|
|
84 <from type="SqlGuid"/>
|
|
85 <from type="SqlChars" >return p.IsNull? null: p.ToSqlString().Value;</from>
|
|
86 <from type="SqlXml" >return p.IsNull? null: p.Value;</from>
|
|
87 <default >return p.ToString();</default>
|
|
88 </group>
|
|
89 <group name="Other Types">
|
|
90 <from type="Type" >return p == null? null: p.FullName;</from>
|
|
91 <from type="XmlDocument">return p == null? null: p.InnerXml;</from>
|
|
92 <from type="Byte[]" >return p == null? null: System.Text.Encoding.UTF8.GetString(p);</from>
|
|
93 <from type="Binary" >return p == null? null: System.Text.Encoding.UTF8.GetString(p.ToArray());</from>
|
|
94 </group>
|
|
95 <default nullvalue="Common.Configuration.NullableValues.String" nothrow="true">
|
|
96 if (p is IConvertible) return ((IConvertible)p).ToString(null);
|
|
97 if (p is IFormattable) return ((IFormattable)p).ToString(null, null);
|
|
98
|
|
99 return p.ToString();</default>
|
|
100 </converter>
|
|
101 <br/>
|
|
102 <converter type="SByte" nullable="false">
|
|
103 <group name="Scalar Types.">
|
|
104 <from type="String" >return p == null? (SByte)0: SByte.Parse(p);</from>
|
|
105 <br/>
|
|
106 <include template ="Numeric Types"/>
|
|
107 <from type="Boolean" >return (SByte)(p? 1: 0);</from>
|
|
108 <from type="Char"/>
|
|
109 <default >return checked((SByte)p);</default>
|
|
110 </group>
|
|
111 <group name="Nullable Types." nullable="true">
|
|
112 <from type="SByte" >return p.HasValue? p.Value: (SByte)0;</from>
|
|
113 <br/>
|
|
114 <include template ="Numeric Types"/>
|
|
115 <from type="Char"/>
|
|
116 <from type="Boolean" >return (p.HasValue && p.Value)? (SByte)1: (SByte)0;</from>
|
|
117 <default >return p.HasValue? checked((SByte)p.Value): (SByte)0;</default>
|
|
118 </group>
|
|
119 <group name="SqlTypes">
|
|
120 <include template ="SqlTypes"/>
|
|
121 <default >return p.IsNull? (SByte)0: ToSByte(p.Value);</default>
|
|
122 </group>
|
|
123 <group name="Other Types">
|
|
124 <from type="Byte[]" >return p == null || p.Length == 0? (SByte)0: checked((SByte)p[0]);</from>
|
|
125 <from type="Binary" >return p == null || p.Length == 0? (SByte)0: checked((SByte)p.ToArray()[0]);</from>
|
|
126 </group>
|
|
127 <default nullvalue="Common.Configuration.NullableValues.SByte">
|
|
128 if (p is IConvertible) return ((IConvertible)p).ToSByte(null);
|
|
129 </default>
|
|
130 </converter>
|
|
131 <converter type="Int16" nullable="false">
|
|
132 <group name="Scalar Types.">
|
|
133 <from type="String" >return p == null? (Int16)0: Int16.Parse(p);</from>
|
|
134 <br/>
|
|
135 <include template ="Numeric Types"/>
|
|
136 <from type="Boolean" >return (Int16)(p? 1: 0);</from>
|
|
137 <from type="Char"/>
|
|
138 <default >return checked((Int16)p);</default>
|
|
139 </group>
|
|
140 <group name="Nullable Types." nullable="true">
|
|
141 <from type="Int16" >return p.HasValue? p.Value: (Int16)0;</from>
|
|
142 <br/>
|
|
143 <include template ="Numeric Types"/>
|
|
144 <from type="Char"/>
|
|
145 <from type="Boolean" >return (p.HasValue && p.Value)? (Int16)1: (Int16)0;</from>
|
|
146 <default >return p.HasValue? checked((Int16)p.Value): (Int16)0;</default>
|
|
147 </group>
|
|
148 <group name="SqlTypes">
|
|
149 <from type="SqlInt16" >return p.IsNull? (Int16)0: p.Value; </from>
|
|
150 <include template ="SqlTypes"/>
|
|
151 <default >return p.IsNull? (Int16)0: ToInt16(p.Value);</default>
|
|
152 </group>
|
|
153 <group name="Other Types">
|
|
154 <from type="Byte[]" >return p == null || p.Length == 0? (Int16)0: BitConverter.ToInt16(p, 0);</from>
|
|
155 <from type="Binary" >return p == null || p.Length == 0? (Int16)0: BitConverter.ToInt16(p.ToArray(), 0);</from>
|
|
156 </group>
|
|
157 <default nullvalue="Common.Configuration.NullableValues.Int16">
|
|
158 if (p is IConvertible) return ((IConvertible)p).ToInt16(null);
|
|
159 </default>
|
|
160 </converter>
|
|
161 <converter type="Int32" nullable="false">
|
|
162 <group name="Scalar Types.">
|
|
163 <from type="String" >return p == null? 0: Int32.Parse(p);</from>
|
|
164 <br/>
|
|
165 <include template ="Numeric Types"/>
|
|
166 <from type="Boolean" >return p? 1: 0;</from>
|
|
167 <from type="Char"/>
|
|
168 <default >return checked((Int32)p);</default>
|
|
169 </group>
|
|
170 <group name="Nullable Types." nullable="true">
|
|
171 <from type="Int32" >return p.HasValue? p.Value: 0;</from>
|
|
172 <br/>
|
|
173 <include template ="Numeric Types"/>
|
|
174 <from type="Char"/>
|
|
175 <from type="Boolean" >return (p.HasValue && p.Value)? 1: 0;</from>
|
|
176 <default >return p.HasValue? checked((Int32)p.Value): 0;</default>
|
|
177 </group>
|
|
178 <group name="SqlTypes">
|
|
179 <from type="SqlInt32" >return p.IsNull? 0: p.Value; </from>
|
|
180 <include template ="SqlTypes"/>
|
|
181 <default >return p.IsNull? 0: ToInt32(p.Value);</default>
|
|
182 </group>
|
|
183 <group name="Other Types">
|
|
184 <from type="Byte[]" >return p == null || p.Length == 0? 0: BitConverter.ToInt32(p, 0);</from>
|
|
185 <from type="Binary" >return p == null || p.Length == 0? 0: BitConverter.ToInt32(p.ToArray(), 0);</from>
|
|
186 </group>
|
|
187 <default nullvalue="Common.Configuration.NullableValues.Int32">
|
|
188 if (p is IConvertible) return ((IConvertible)p).ToInt32(null);
|
|
189 </default>
|
|
190 </converter>
|
|
191 <converter type="Int64" nullable="false">
|
|
192 <group name="Scalar Types.">
|
|
193 <from type="String" >return p == null? 0: Int64.Parse(p);</from>
|
|
194 <br/>
|
|
195 <include template ="Numeric Types"/>
|
|
196 <from type="Char"/>
|
|
197 <from type="Boolean" >return p? 1: 0;</from>
|
|
198 <from type="DateTime" >return (p - DateTime.MinValue).Ticks;</from>
|
|
199 <from type="DateTimeOffset" >return (p - DateTime.MinValue).Ticks;</from>
|
|
200 <from type="TimeSpan" >return p.Ticks;</from>
|
|
201 <default >return checked((Int64)p);</default>
|
|
202 </group>
|
|
203 <group name="Nullable Types." nullable="true">
|
|
204 <from type="Int64" >return p.HasValue? p.Value: 0;</from>
|
|
205 <br/>
|
|
206 <include template ="Numeric Types"/>
|
|
207 <from type="Char"/>
|
|
208 <from type="Boolean" >return (p.HasValue && p.Value)? 1: 0;</from>
|
|
209 <from type="DateTime" >return p.HasValue? (p.Value - DateTime.MinValue).Ticks: 0;</from>
|
|
210 <from type="DateTimeOffset" >return p.HasValue? (p.Value - DateTime.MinValue).Ticks: 0;</from>
|
|
211 <from type="TimeSpan" >return p.HasValue? p.Value.Ticks: 0;</from>
|
|
212 <default >return p.HasValue? checked((Int64)p.Value): 0;</default>
|
|
213 </group>
|
|
214 <group name="SqlTypes">
|
|
215 <from type="SqlInt64" >return p.IsNull? 0: p.Value; </from>
|
|
216 <include template ="SqlTypes"/>
|
|
217 <from type="SqlDateTime"/>
|
|
218 <default >return p.IsNull? 0: ToInt64(p.Value);</default>
|
|
219 </group>
|
|
220 <group name="Other Types">
|
|
221 <from type="Byte[]" >return p == null || p.Length == 0? 0: BitConverter.ToInt64(p, 0);</from>
|
|
222 <from type="Binary" >return p == null || p.Length == 0? 0: BitConverter.ToInt64(p.ToArray(), 0);</from>
|
|
223 </group>
|
|
224 <default nullvalue="Common.Configuration.NullableValues.Int64">
|
|
225 if (p is IConvertible) return ((IConvertible)p).ToInt64(null);
|
|
226 </default>
|
|
227 </converter>
|
|
228 <br/>
|
|
229 <converter type="Byte" nullable="false">
|
|
230 <group name="Scalar Types.">
|
|
231 <from type="String" >return p == null? (Byte)0: Byte.Parse(p);</from>
|
|
232 <br/>
|
|
233 <include template ="Numeric Types"/>
|
|
234 <from type="Boolean" >return (Byte)(p? 1: 0);</from>
|
|
235 <from type="Char"/>
|
|
236 <default >return checked((Byte)p);</default>
|
|
237 </group>
|
|
238 <group name="Nullable Types." nullable="true">
|
|
239 <from type="Byte" >return p.HasValue? p.Value: (Byte)0;</from>
|
|
240 <br/>
|
|
241 <include template ="Numeric Types"/>
|
|
242 <from type="Char"/>
|
|
243 <from type="Boolean" >return (p.HasValue && p.Value)? (Byte)1: (Byte)0;</from>
|
|
244 <default >return p.HasValue? checked((Byte)p.Value): (Byte)0;</default>
|
|
245 </group>
|
|
246 <group name="SqlTypes">
|
|
247 <from type="SqlByte" >return p.IsNull? (Byte)0: p.Value; </from>
|
|
248 <include template ="SqlTypes"/>
|
|
249 <default >return p.IsNull? (Byte)0: ToByte(p.Value);</default>
|
|
250 </group>
|
|
251 <group name="Other Types">
|
|
252 <from type="Byte[]" >return p == null || p.Length == 0? (Byte)0: p[0];</from>
|
|
253 <from type="Binary" >return p == null || p.Length == 0? (Byte)0: p.ToArray()[0];</from>
|
|
254 </group>
|
|
255 <default nullvalue="Common.Configuration.NullableValues.Byte">
|
|
256 if (p is IConvertible) return ((IConvertible)p).ToByte(null);
|
|
257 </default>
|
|
258 </converter>
|
|
259 <converter type="UInt16" nullable="false">
|
|
260 <group name="Scalar Types.">
|
|
261 <from type="String" >return p == null? (UInt16)0: UInt16.Parse(p);</from>
|
|
262 <br/>
|
|
263 <include template ="Numeric Types"/>
|
|
264 <from type="Boolean" >return (UInt16)(p? 1: 0);</from>
|
|
265 <from type="Char"/>
|
|
266 <default >return checked((UInt16)p);</default>
|
|
267 </group>
|
|
268 <group name="Nullable Types." nullable="true">
|
|
269 <from type="UInt16" >return p.HasValue? p.Value: (UInt16)0;</from>
|
|
270 <br/>
|
|
271 <include template ="Numeric Types"/>
|
|
272 <from type="Char"/>
|
|
273 <from type="Boolean" >return (p.HasValue && p.Value)? (UInt16)1: (UInt16)0;</from>
|
|
274 <default >return p.HasValue? checked((UInt16)p.Value): (UInt16)0;</default>
|
|
275 </group>
|
|
276 <group name="SqlTypes">
|
|
277 <include template ="SqlTypes"/>
|
|
278 <default >return p.IsNull? (UInt16)0: ToUInt16(p.Value);</default>
|
|
279 </group>
|
|
280 <group name="Other Types">
|
|
281 <from type="Byte[]" >return p == null || p.Length == 0? (UInt16)0: BitConverter.ToUInt16(p, 0);</from>
|
|
282 <from type="Binary" >return p == null || p.Length == 0? (UInt16)0: BitConverter.ToUInt16(p.ToArray(), 0);</from>
|
|
283 </group>
|
|
284 <default nullvalue="Common.Configuration.NullableValues.UInt16">
|
|
285 if (p is IConvertible) return ((IConvertible)p).ToUInt16(null);
|
|
286 </default>
|
|
287 </converter>
|
|
288 <converter type="UInt32" nullable="false">
|
|
289 <group name="Scalar Types.">
|
|
290 <from type="String" >return p == null? 0: UInt32.Parse(p);</from>
|
|
291 <br/>
|
|
292 <include template ="Numeric Types"/>
|
|
293 <from type="Boolean" >return (UInt32)(p? 1: 0);</from>
|
|
294 <from type="Char"/>
|
|
295 <default >return checked((UInt32)p);</default>
|
|
296 </group>
|
|
297 <group name="Nullable Types." nullable="true">
|
|
298 <from type="UInt32" >return p.HasValue? p.Value: 0;</from>
|
|
299 <br/>
|
|
300 <include template ="Numeric Types"/>
|
|
301 <from type="Char"/>
|
|
302 <from type="Boolean" >return (p.HasValue && p.Value)? (UInt32)1: 0;</from>
|
|
303 <default >return p.HasValue? checked((UInt32)p.Value): 0;</default>
|
|
304 </group>
|
|
305 <group name="SqlTypes">
|
|
306 <include template ="SqlTypes"/>
|
|
307 <default >return p.IsNull? 0: ToUInt32(p.Value);</default>
|
|
308 </group>
|
|
309 <group name="Other Types">
|
|
310 <from type="Byte[]" >return p == null || p.Length == 0? 0: BitConverter.ToUInt32(p, 0);</from>
|
|
311 <from type="Binary" >return p == null || p.Length == 0? 0: BitConverter.ToUInt32(p.ToArray(), 0);</from>
|
|
312 </group>
|
|
313 <default nullvalue="Common.Configuration.NullableValues.UInt32">
|
|
314 if (p is IConvertible) return ((IConvertible)p).ToUInt32(null);
|
|
315 </default>
|
|
316 </converter>
|
|
317 <converter type="UInt64" nullable="false">
|
|
318 <group name="Scalar Types.">
|
|
319 <from type="String" >return p == null? 0: UInt64.Parse(p);</from>
|
|
320 <br/>
|
|
321 <include template ="Numeric Types"/>
|
|
322 <from type="Boolean" >return (UInt64)(p? 1: 0);</from>
|
|
323 <from type="Char"/>
|
|
324 <default >return checked((UInt64)p);</default>
|
|
325 </group>
|
|
326 <group name="Nullable Types." nullable="true">
|
|
327 <from type="UInt64" >return p.HasValue? p.Value: 0;</from>
|
|
328 <br/>
|
|
329 <include template ="Numeric Types"/>
|
|
330 <from type="Char"/>
|
|
331 <from type="Boolean" >return (p.HasValue && p.Value)? (UInt64)1: 0;</from>
|
|
332 <default >return p.HasValue? checked((UInt64)p.Value): 0;</default>
|
|
333 </group>
|
|
334 <group name="SqlTypes">
|
|
335 <include template ="SqlTypes"/>
|
|
336 <default >return p.IsNull? 0: ToUInt64(p.Value);</default>
|
|
337 </group>
|
|
338 <group name="Other Types">
|
|
339 <from type="Byte[]" >return p == null || p.Length == 0? 0: BitConverter.ToUInt64(p, 0);</from>
|
|
340 <from type="Binary" >return p == null || p.Length == 0? 0: BitConverter.ToUInt64(p.ToArray(), 0);</from>
|
|
341 </group>
|
|
342 <default nullvalue="Common.Configuration.NullableValues.UInt64">
|
|
343 if (p is IConvertible) return ((IConvertible)p).ToUInt64(null);
|
|
344 </default>
|
|
345 </converter>
|
|
346 <br/>
|
|
347 <converter type="Char" nullable="false">
|
|
348 <group name="Scalar Types.">
|
|
349 <from type="String" >return p == null? (Char)0: Char.Parse(p);</from>
|
|
350 <br/>
|
|
351 <include template ="Numeric Types"/>
|
|
352 <from type="Boolean" >return (Char)(p? 1: 0);</from>
|
|
353 <default >return checked((Char)p);</default>
|
|
354 </group>
|
|
355 <group name="Nullable Types." nullable="true">
|
|
356 <from type="Char" >return p.HasValue? p.Value: (Char)0;</from>
|
|
357 <br/>
|
|
358 <include template ="Numeric Types"/>
|
|
359 <from type="Boolean" >return (p.HasValue && p.Value)? (Char)1: (Char)0;</from>
|
|
360 <default >return p.HasValue? checked((Char)p.Value): (Char)0;</default>
|
|
361 </group>
|
|
362 <group name="SqlTypes">
|
|
363 <include template ="SqlTypes"/>
|
|
364 <default >return p.IsNull? (Char)0: ToChar(p.Value);</default>
|
|
365 </group>
|
|
366 <group name="Other Types">
|
|
367 <from type="Byte[]" >return p == null || p.Length == 0? (Char)0: BitConverter.ToChar(p, 0);</from>
|
|
368 <from type="Binary" >return p == null || p.Length == 0? (Char)0: BitConverter.ToChar(p.ToArray(), 0);</from>
|
|
369 </group>
|
|
370 <default nullvalue="Common.Configuration.NullableValues.Char">
|
|
371 if (p is IConvertible) return ((IConvertible)p).ToChar(null);
|
|
372 </default>
|
|
373 </converter>
|
|
374 <converter type="Single" nullable="false">
|
|
375 <group name="Scalar Types.">
|
|
376 <from type="String" >return p == null? 0.0f: Single.Parse(p);</from>
|
|
377 <br/>
|
|
378 <include template ="Numeric Types"/>
|
|
379 <from type="Boolean" >return p? 1.0f: 0.0f;</from>
|
|
380 <from type="Char"/>
|
|
381 <default >return checked((Single)p);</default>
|
|
382 </group>
|
|
383 <group name="Nullable Types." nullable="true">
|
|
384 <from type="Single" >return p.HasValue? p.Value: 0.0f;</from>
|
|
385 <br/>
|
|
386 <include template ="Numeric Types"/>
|
|
387 <from type="Char"/>
|
|
388 <from type="Boolean" >return (p.HasValue && p.Value)? 1.0f: 0.0f;</from>
|
|
389 <default >return p.HasValue? checked((Single)p.Value): 0.0f;</default>
|
|
390 </group>
|
|
391 <group name="SqlTypes">
|
|
392 <from type="SqlSingle">return p.IsNull? 0.0f: p.Value; </from>
|
|
393 <include template ="SqlTypes"/>
|
|
394 <default >return p.IsNull? 0.0f: ToSingle(p.Value);</default>
|
|
395 </group>
|
|
396 <group name="Other Types">
|
|
397 <from type="Byte[]" >return p == null || p.Length == 0? 0.0f: BitConverter.ToSingle(p, 0);</from>
|
|
398 <from type="Binary" >return p == null || p.Length == 0? 0.0f: BitConverter.ToSingle(p.ToArray(), 0);</from>
|
|
399 </group>
|
|
400 <default nullvalue="Common.Configuration.NullableValues.Single">
|
|
401 if (p is IConvertible) return ((IConvertible)p).ToSingle(null);
|
|
402 </default>
|
|
403 </converter>
|
|
404 <converter type="Double" nullable="false">
|
|
405 <group name="Scalar Types.">
|
|
406 <from type="String" >return p == null? 0.0: Double.Parse(p);</from>
|
|
407 <br/>
|
|
408 <include template ="Numeric Types"/>
|
|
409 <from type="Boolean" >return p? 1.0: 0.0;</from>
|
|
410 <from type="Char"/>
|
|
411 <from type="DateTime" >return (p - DateTime.MinValue).TotalDays;</from>
|
|
412 <from type="DateTimeOffset" >return (p - DateTime.MinValue).TotalDays;</from>
|
|
413 <from type="TimeSpan" >return p.TotalDays;</from>
|
|
414 <default >return checked((Double)p);</default>
|
|
415 </group>
|
|
416 <group name="Nullable Types." nullable="true">
|
|
417 <from type="Double" >return p.HasValue? p.Value: 0.0;</from>
|
|
418 <br/>
|
|
419 <include template ="Numeric Types"/>
|
|
420 <from type="Char"/>
|
|
421 <from type="Boolean" >return (p.HasValue && p.Value)? 1.0: 0.0;</from>
|
|
422 <from type="DateTime" >return p.HasValue? (p.Value - DateTime.MinValue).TotalDays: 0.0;</from>
|
|
423 <from type="DateTimeOffset" >return p.HasValue? (p.Value - DateTime.MinValue).TotalDays: 0.0;</from>
|
|
424 <from type="TimeSpan" >return p.HasValue? p.Value.TotalDays: 0.0;</from>
|
|
425 <default >return p.HasValue? checked((Double)p.Value): 0.0;</default>
|
|
426 </group>
|
|
427 <group name="SqlTypes">
|
|
428 <from type="SqlDouble">return p.IsNull? 0.0: p.Value; </from>
|
|
429 <include template ="SqlTypes"/>
|
|
430 <from type="SqlDateTime"/>
|
|
431 <default >return p.IsNull? 0.0: ToDouble(p.Value);</default>
|
|
432 </group>
|
|
433 <group name="Other Types">
|
|
434 <from type="Byte[]" >return p == null || p.Length == 0? 0.0: BitConverter.ToDouble(p, 0);</from>
|
|
435 <from type="Binary" >return p == null || p.Length == 0? 0.0: BitConverter.ToDouble(p.ToArray(), 0);</from>
|
|
436 </group>
|
|
437 <default nullvalue="Common.Configuration.NullableValues.Double">
|
|
438 if (p is IConvertible) return ((IConvertible)p).ToDouble(null);
|
|
439 </default>
|
|
440 </converter>
|
|
441 <br/>
|
|
442 <converter type="Boolean" nullable="false">
|
|
443 <group name="Scalar Types.">
|
|
444 <from type="String">return p == null? false : p.Length == 1 ? ToBoolean(p[0]) : Boolean.Parse(p);</from>
|
|
445 <br/>
|
|
446 <include template ="Numeric Types"/>
|
|
447 <br/>
|
|
448 <from type="Char">
|
|
449 switch (p)
|
|
450 {
|
|
451 case (Char)0: return false; // Allow int <=> Char <=> Boolean
|
|
452 case '0': return false;
|
|
453 case 'n': return false;
|
|
454 case 'N': return false;
|
|
455 case 'f': return false;
|
|
456 case 'F': return false;
|
|
457
|
|
458 case (Char)1: return true; // Allow int <=> Char <=> Boolean
|
|
459 case '1': return true;
|
|
460 case 'y': return true;
|
|
461 case 'Y': return true;
|
|
462 case 't': return true;
|
|
463 case 'T': return true;
|
|
464 }
|
|
465
|
|
466 throw CreateInvalidCastException(typeof(Char), typeof(Boolean));</from>
|
|
467 <default >return p != 0;</default>
|
|
468 </group>
|
|
469 <group name="Nullable Types." nullable="true">
|
|
470 <from type="Boolean" >return p.HasValue? p.Value: false;</from>
|
|
471 <br/>
|
|
472 <include template ="Numeric Types"/>
|
|
473 <br/>
|
|
474 <from type="Char" >return p.HasValue? ToBoolean(p.Value): false;</from>
|
|
475 <default >return p.HasValue? p.Value != 0: false;</default>
|
|
476 </group>
|
|
477 <group name="SqlTypes">
|
|
478 <from type="SqlBoolean">return p.IsNull? false: p.Value; </from>
|
|
479 <include template ="SqlTypes"/>
|
|
480 <default >return p.IsNull? false: ToBoolean(p.Value);</default>
|
|
481 </group>
|
|
482 <group name="Other Types">
|
|
483 <from type="Byte[]" >return p == null || p.Length == 0? false: BitConverter.ToBoolean(p, 0);</from>
|
|
484 <from type="Binary" >return p == null || p.Length == 0? false: BitConverter.ToBoolean(p.ToArray(), 0);</from>
|
|
485 </group>
|
|
486 <default nullvalue="Common.Configuration.NullableValues.Boolean">
|
|
487 if (p is IConvertible) return ((IConvertible)p).ToBoolean(null);
|
|
488 </default>
|
|
489 </converter>
|
|
490 <converter type="Decimal" nullable="false">
|
|
491 <group name="Scalar Types.">
|
|
492 <from type="String" >return p == null? 0.0m: Decimal.Parse(p);</from>
|
|
493 <br/>
|
|
494 <include template ="Numeric Types"/>
|
|
495 <from type="Boolean" >return p? 1.0m: 0.0m;</from>
|
|
496 <from type="Char"/>
|
|
497 <default >return checked((Decimal)p);</default>
|
|
498 </group>
|
|
499 <group name="Nullable Types." nullable="true">
|
|
500 <from type="Decimal" >return p.HasValue? p.Value: 0.0m;</from>
|
|
501 <br/>
|
|
502 <include template ="Numeric Types"/>
|
|
503 <from type="Char"/>
|
|
504 <from type="Boolean" >return (p.HasValue && p.Value)? 1.0m: 0.0m;</from>
|
|
505 <default >return p.HasValue? checked((Decimal)p.Value): 0.0m;</default>
|
|
506 </group>
|
|
507 <group name="SqlTypes">
|
|
508 <from type="SqlDecimal">return p.IsNull? 0.0m: p.Value; </from>
|
|
509 <from type="SqlMoney" >return p.IsNull? 0.0m: p.Value; </from>
|
|
510 <include template ="SqlTypes"/>
|
|
511 <default >return p.IsNull? 0.0m: ToDecimal(p.Value);</default>
|
|
512 </group>
|
|
513 <group name="Other Types">
|
|
514 <from type="Byte[]">
|
|
515 if (p == null || p.Length == 0) return 0.0m;
|
|
516
|
|
517 int[] bits = new int[p.Length / sizeof(int)];
|
|
518
|
|
519 Buffer.BlockCopy(p, 0, bits, 0, p.Length);
|
|
520 return new Decimal(bits);</from>
|
|
521 <from type="Binary">
|
|
522 if (p == null || p.Length == 0) return 0.0m;
|
|
523
|
|
524 int[] bits = new int[p.Length / sizeof(int)];
|
|
525
|
|
526 Buffer.BlockCopy(p.ToArray(), 0, bits, 0, p.Length);
|
|
527 return new Decimal(bits);
|
|
528 </from>
|
|
529 </group>
|
|
530 <default nullvalue="Common.Configuration.NullableValues.Decimal">
|
|
531 if (p is IConvertible) return ((IConvertible)p).ToDecimal(null);
|
|
532 </default>
|
|
533 </converter>
|
|
534 <converter type="DateTime" nullable="false">
|
|
535 <group name="Scalar Types.">
|
|
536 <from type="String" >return p == null? DateTime.MinValue: DateTime.Parse(p, null, DateTimeStyles.NoCurrentDateDefault);</from>
|
|
537 <from type="TimeSpan" >return DateTime.MinValue + p;</from>
|
|
538 <from type="Int64" >return DateTime.MinValue + TimeSpan.FromTicks(p);</from>
|
|
539 <from type="Double" >return DateTime.MinValue + TimeSpan.FromDays(p);</from>
|
|
540 <from type="DateTimeOffset" >return p.LocalDateTime;</from>
|
|
541 </group>
|
|
542 <group name="Nullable Types." nullable="true">
|
|
543 <from type="DateTime" >return p.HasValue? p.Value: DateTime.MinValue;</from>
|
|
544 <from type="DateTimeOffset" >return p.HasValue? p.Value.LocalDateTime: DateTime.MinValue;</from>
|
|
545 <from type="TimeSpan" >return p.HasValue? DateTime.MinValue + p.Value: DateTime.MinValue;</from>
|
|
546 <from type="Int64" >return p.HasValue? DateTime.MinValue + TimeSpan.FromTicks(p.Value): DateTime.MinValue;</from>
|
|
547 <from type="Double" >return p.HasValue? DateTime.MinValue + TimeSpan.FromDays(p.Value): DateTime.MinValue;</from>
|
|
548 </group>
|
|
549 <group name="SqlTypes">
|
|
550 <from type="SqlDateTime">return p.IsNull? DateTime.MinValue: p.Value; </from>
|
|
551 <from type="SqlString" >return p.IsNull? DateTime.MinValue: ToDateTime(p.Value);</from>
|
|
552 <from type="SqlInt64" >return p.IsNull? DateTime.MinValue: DateTime.MinValue + TimeSpan.FromTicks(p.Value);</from>
|
|
553 <from type="SqlDouble" >return p.IsNull? DateTime.MinValue: DateTime.MinValue + TimeSpan.FromDays(p.Value);</from>
|
|
554 </group>
|
|
555 <group name="Other Types">
|
|
556 <from type="Byte[]" >return p == null || p.Length == 0? DateTime.MinValue: DateTime.FromBinary(ToInt64(p));</from>
|
|
557 <from type="Binary" >return p == null || p.Length == 0? DateTime.MinValue: DateTime.FromBinary(ToInt64(p.ToArray()));</from>
|
|
558 </group>
|
|
559 <default nullvalue="Common.Configuration.NullableValues.DateTime">
|
|
560 if (p is IConvertible) return ((IConvertible)p).ToDateTime(null);
|
|
561 </default>
|
|
562 </converter>
|
|
563 <converter type="DateTimeOffset" nullable="false">
|
|
564 <group name="Scalar Types.">
|
|
565 <from type="String" >return p == null? DateTimeOffset.MinValue: DateTimeOffset.Parse(p);</from>
|
|
566 <from type="TimeSpan" >return DateTimeOffset.MinValue + p;</from>
|
|
567 <from type="Int64" >return DateTimeOffset.MinValue + TimeSpan.FromTicks(p);</from>
|
|
568 <from type="Double" >return DateTimeOffset.MinValue + TimeSpan.FromDays(p);</from>
|
|
569 <from type="DateTime" >return p;</from>
|
|
570 </group>
|
|
571 <group name="Nullable Types." nullable="true">
|
|
572 <from type="DateTimeOffset" >return p.HasValue? p.Value: DateTimeOffset.MinValue;</from>
|
|
573 <from type="DateTime" >return p.HasValue? p.Value: DateTimeOffset.MinValue;</from>
|
|
574 <from type="TimeSpan" >return p.HasValue? DateTimeOffset.MinValue + p.Value: DateTimeOffset.MinValue;</from>
|
|
575 <from type="Int64" >return p.HasValue? DateTimeOffset.MinValue + TimeSpan.FromTicks(p.Value): DateTimeOffset.MinValue;</from>
|
|
576 <from type="Double" >return p.HasValue? DateTimeOffset.MinValue + TimeSpan.FromDays(p.Value): DateTimeOffset.MinValue;</from>
|
|
577 </group>
|
|
578 <group name="SqlTypes">
|
|
579 <from type="SqlDateTime">return p.IsNull? DateTimeOffset.MinValue: p.Value; </from>
|
|
580 <from type="SqlString" >return p.IsNull? DateTimeOffset.MinValue: ToDateTimeOffset(p.Value);</from>
|
|
581 <from type="SqlInt64" >return p.IsNull? DateTimeOffset.MinValue: DateTimeOffset.MinValue + TimeSpan.FromTicks(p.Value);</from>
|
|
582 <from type="SqlDouble" >return p.IsNull? DateTimeOffset.MinValue: DateTimeOffset.MinValue + TimeSpan.FromDays(p.Value);</from>
|
|
583 </group>
|
|
584 <group name="Other Types">
|
|
585 <from type="Byte[]" >return p == null || p.Length == 0? DateTimeOffset.MinValue: new DateTimeOffset(ToDateTime(p));</from>
|
|
586 <from type="Binary" >return p == null || p.Length == 0? DateTimeOffset.MinValue: new DateTimeOffset(ToDateTime(p.ToArray()));</from>
|
|
587 </group>
|
|
588 <default nullvalue="Common.Configuration.NullableValues.DateTimeOffset">
|
|
589 if (p is IConvertible) return ToDateTimeOffset(((IConvertible)p).ToDateTime(null));
|
|
590 </default>
|
|
591 </converter>
|
|
592 <converter type="TimeSpan" nullable="false">
|
|
593 <group name="Scalar Types.">
|
|
594 <from type="String" >return p == null? TimeSpan.MinValue: TimeSpan.Parse(p);</from>
|
|
595 <from type="DateTime" >return p - DateTime.MinValue;</from>
|
|
596 <from type="DateTimeOffset">return p - DateTimeOffset.MinValue;</from>
|
|
597 <from type="Int64" >return TimeSpan.FromTicks(p);</from>
|
|
598 <from type="Double" >return TimeSpan.FromDays(p);</from>
|
|
599 </group>
|
|
600 <group name="Nullable Types." nullable="true">
|
|
601 <from type="TimeSpan" >return p.HasValue? p.Value: TimeSpan.MinValue;</from>
|
|
602 <from type="DateTime" >return p.HasValue? p.Value - DateTime.MinValue: TimeSpan.MinValue;</from>
|
|
603 <from type="DateTimeOffset" >return p.HasValue? p.Value - DateTimeOffset.MinValue: TimeSpan.MinValue;</from>
|
|
604 <from type="Int64" >return p.HasValue? TimeSpan.FromTicks(p.Value): TimeSpan.MinValue;</from>
|
|
605 <from type="Double" >return p.HasValue? TimeSpan.FromDays(p.Value): TimeSpan.MinValue;</from>
|
|
606 </group>
|
|
607 <group name="SqlTypes">
|
|
608 <from type="SqlString" >return p.IsNull? TimeSpan.MinValue: TimeSpan.Parse(p.Value); </from>
|
|
609 <from type="SqlDateTime">return p.IsNull? TimeSpan.MinValue: p.Value - DateTime.MinValue;</from>
|
|
610 <from type="SqlInt64" >return p.IsNull? TimeSpan.MinValue: TimeSpan.FromTicks(p.Value);</from>
|
|
611 <from type="SqlDouble" >return p.IsNull? TimeSpan.MinValue: TimeSpan.FromDays(p.Value);</from>
|
|
612 </group>
|
|
613 <group name="Other Types">
|
|
614 <from type="Byte[]" >return p == null || p.Length == 0? TimeSpan.MinValue: TimeSpan.FromTicks(ToInt64(p));</from>
|
|
615 <from type="Binary" >return p == null || p.Length == 0? TimeSpan.MinValue: TimeSpan.FromTicks(ToInt64(p.ToArray()));</from>
|
|
616 </group>
|
|
617 <default nullvalue="Common.Configuration.NullableValues.TimeSpan"/>
|
|
618 </converter>
|
|
619 <converter type="Guid" nullable="false">
|
|
620 <group name="Scalar Types.">
|
|
621 <from type="String" >return p == null? Guid.Empty: new Guid(p);</from>
|
|
622 </group>
|
|
623 <group name="Nullable Types." nullable="true">
|
|
624 <from type="Guid" >return p.HasValue? p.Value: Guid.Empty;</from>
|
|
625 </group>
|
|
626 <group name="SqlTypes">
|
|
627 <from type="SqlGuid" >return p.IsNull? Guid.Empty: p.Value; </from>
|
|
628 <from type="SqlString">return p.IsNull? Guid.Empty: new Guid(p.Value); </from>
|
|
629 <from type="SqlBinary">return p.IsNull? Guid.Empty: p.ToSqlGuid().Value;</from>
|
|
630 </group>
|
|
631 <group name="Other Types.">
|
|
632 <from type="Byte[]" >return p == null? Guid.Empty: new Guid(p);</from>
|
|
633 <from type="Binary" >return p == null? Guid.Empty: new Guid(p.ToArray());</from>
|
|
634 <from type="Type" >return p == null? Guid.Empty: p.GUID;</from>
|
|
635 </group>
|
|
636 <default nullvalue="Common.Configuration.NullableValues.Guid"/>
|
|
637 </converter>
|
|
638 </region>
|
|
639 <region name="Nullable Types">
|
|
640 <converter type="SByte" nullable="true">
|
|
641 <group name="Scalar Types.">
|
|
642 <from type="SByte" >return p;</from>
|
|
643 <from type="String" >return p == null? null: (SByte?)SByte.Parse(p);</from>
|
|
644 <br/>
|
|
645 <include template ="Numeric Types"/>
|
|
646 <from type="Char"/>
|
|
647 <from type="Boolean">return (SByte?)(p? 1: 0);</from>
|
|
648 <default >return checked((SByte?)p);</default>
|
|
649 </group>
|
|
650 <group name="Nullable Types." nullable="true">
|
|
651 <include template ="Numeric Types"/>
|
|
652 <from type="Char"/>
|
|
653 <from type="Boolean">return p.HasValue? (SByte?)(p.Value? 1: 0): null;</from>
|
|
654 <default >return p.HasValue? checked((SByte?)p.Value): null;</default>
|
|
655 </group>
|
|
656 <group name="SqlTypes">
|
|
657 <include template ="SqlTypes"/>
|
|
658 <default >return p.IsNull? null: ToNullableSByte(p.Value);</default>
|
|
659 </group>
|
|
660 <group name="Other Types">
|
|
661 <from type="Byte[]" >return p == null || p.Length == 0? null: (SByte?)ToSByte(p);</from>
|
|
662 <from type="Binary" >return p == null || p.Length == 0? null: (SByte?)ToSByte(p.ToArray());</from>
|
|
663 </group>
|
|
664 <default nullvalue="null">
|
|
665 if (p is IConvertible) return ((IConvertible)p).ToSByte(null);
|
|
666 </default>
|
|
667 </converter>
|
|
668 <converter type="Int16" nullable="true">
|
|
669 <group name="Scalar Types.">
|
|
670 <from type="Int16" >return p;</from>
|
|
671 <from type="String" >return p == null? null: (Int16?)Int16.Parse(p);</from>
|
|
672 <br/>
|
|
673 <include template ="Numeric Types"/>
|
|
674 <from type="Char"/>
|
|
675 <from type="Boolean">return (Int16?)(p? 1: 0);</from>
|
|
676 <default >return checked((Int16?)p);</default>
|
|
677 </group>
|
|
678 <group name="Nullable Types." nullable="true">
|
|
679 <include template ="Numeric Types"/>
|
|
680 <from type="Char"/>
|
|
681 <from type="Boolean">return p.HasValue? (Int16?)(p.Value? 1: 0): null;</from>
|
|
682 <default >return p.HasValue? checked((Int16?)p.Value): null;</default>
|
|
683 </group>
|
|
684 <group name="SqlTypes">
|
|
685 <from type="SqlInt16" >return p.IsNull? null: (Int16?)p.Value; </from>
|
|
686 <include template ="SqlTypes"/>
|
|
687 <default >return p.IsNull? null: ToNullableInt16(p.Value);</default>
|
|
688 </group>
|
|
689 <group name="Other Types">
|
|
690 <from type="Byte[]" >return p == null || p.Length == 0? null: (Int16?)ToInt16(p);</from>
|
|
691 <from type="Binary" >return p == null || p.Length == 0? null: (Int16?)ToInt16(p.ToArray());</from>
|
|
692 </group>
|
|
693 <default nullvalue="null">
|
|
694 if (p is IConvertible) return ((IConvertible)p).ToInt16(null);
|
|
695 </default>
|
|
696 </converter>
|
|
697 <converter type="Int32" nullable="true">
|
|
698 <group name="Scalar Types.">
|
|
699 <from type="Int32" >return p;</from>
|
|
700 <from type="String" >return p == null? null: (Int32?)Int32.Parse(p);</from>
|
|
701 <br/>
|
|
702 <include template ="Numeric Types"/>
|
|
703 <from type="Char"/>
|
|
704 <from type="Boolean">return p? 1: 0;</from>
|
|
705 <default >return checked((Int32?)p);</default>
|
|
706 </group>
|
|
707 <group name="Nullable Types." nullable="true">
|
|
708 <include template ="Numeric Types"/>
|
|
709 <from type="Char"/>
|
|
710 <from type="Boolean">return p.HasValue? (Int32?)(p.Value? 1: 0): null;</from>
|
|
711 <default >return p.HasValue? checked((Int32?)p.Value): null;</default>
|
|
712 </group>
|
|
713 <group name="SqlTypes">
|
|
714 <from type="SqlInt32" >return p.IsNull? null: (Int32?)p.Value; </from>
|
|
715 <include template ="SqlTypes"/>
|
|
716 <default >return p.IsNull? null: ToNullableInt32(p.Value);</default>
|
|
717 </group>
|
|
718 <group name="Other Types">
|
|
719 <from type="Byte[]" >return p == null || p.Length == 0? null: (Int32?)ToInt32(p);</from>
|
|
720 <from type="Binary" >return p == null || p.Length == 0? null: (Int32?)ToInt32(p.ToArray());</from>
|
|
721 </group>
|
|
722 <default nullvalue="null">
|
|
723 if (p is IConvertible) return ((IConvertible)p).ToInt32(null);
|
|
724 </default>
|
|
725 </converter>
|
|
726 <converter type="Int64" nullable="true">
|
|
727 <group name="Scalar Types.">
|
|
728 <from type="Int64" >return p;</from>
|
|
729 <from type="String" >return p == null? null: (Int64?)Int64.Parse(p);</from>
|
|
730 <br/>
|
|
731 <include template ="Numeric Types"/>
|
|
732 <from type="Char"/>
|
|
733 <from type="Boolean" >return p? 1: 0;</from>
|
|
734 <from type="DateTime">return (p - DateTime.MinValue).Ticks;</from>
|
|
735 <from type="DateTimeOffset">return (p - DateTimeOffset.MinValue).Ticks;</from>
|
|
736 <from type="TimeSpan">return p.Ticks;</from>
|
|
737 <default >return checked((Int64?)p);</default>
|
|
738 </group>
|
|
739 <group name="Nullable Types." nullable="true">
|
|
740 <include template ="Numeric Types"/>
|
|
741 <from type="Char"/>
|
|
742 <from type="Boolean">return p.HasValue? (Int64?)(p.Value? 1: 0): null;</from>
|
|
743 <from type="DateTime">return p.HasValue? (Int64?)(p.Value - DateTime.MinValue).Ticks: null;</from>
|
|
744 <from type="DateTimeOffset">return p.HasValue? (Int64?)(p.Value - DateTimeOffset.MinValue).Ticks: null;</from>
|
|
745 <from type="TimeSpan">return p.HasValue? (Int64?)p.Value.Ticks: null;</from>
|
|
746 <default >return p.HasValue? checked((Int64?)p.Value): null;</default>
|
|
747 </group>
|
|
748 <group name="SqlTypes">
|
|
749 <from type="SqlInt64">return p.IsNull? null: (Int64?)p.Value; </from>
|
|
750 <include template ="SqlTypes"/>
|
|
751 <from type="SqlDateTime"/>
|
|
752 <default >return p.IsNull? null: ToNullableInt64(p.Value);</default>
|
|
753 </group>
|
|
754 <group name="Other Types">
|
|
755 <from type="Byte[]" >return p == null || p.Length == 0? null: (Int64?)ToInt64(p);</from>
|
|
756 <from type="Binary" >return p == null || p.Length == 0? null: (Int64?)ToInt64(p.ToArray());</from>
|
|
757 </group>
|
|
758 <default nullvalue="null">
|
|
759 if (p is IConvertible) return ((IConvertible)p).ToInt64(null);
|
|
760 </default>
|
|
761 </converter>
|
|
762 <br/>
|
|
763 <converter type="Byte" nullable="true">
|
|
764 <group name="Scalar Types.">
|
|
765 <from type="Byte" >return p;</from>
|
|
766 <from type="String" >return p == null? null: (Byte?)Byte.Parse(p);</from>
|
|
767 <br/>
|
|
768 <include template ="Numeric Types"/>
|
|
769 <from type="Char"/>
|
|
770 <from type="Boolean">return (Byte?)(p? 1: 0);</from>
|
|
771 <default >return checked((Byte?)p);</default>
|
|
772 </group>
|
|
773 <group name="Nullable Types." nullable="true">
|
|
774 <include template ="Numeric Types"/>
|
|
775 <from type="Char"/>
|
|
776 <from type="Boolean">return p.HasValue? (Byte?)(p.Value? 1: 0): null;</from>
|
|
777 <default >return p.HasValue? checked((Byte?)p.Value): null;</default>
|
|
778 </group>
|
|
779 <group name="SqlTypes">
|
|
780 <from type="SqlByte" >return p.IsNull? null: (Byte?)p.Value; </from>
|
|
781 <include template ="SqlTypes"/>
|
|
782 <default >return p.IsNull? null: ToNullableByte(p.Value);</default>
|
|
783 </group>
|
|
784 <group name="Other Types">
|
|
785 <from type="Byte[]" >return p == null || p.Length == 0? null: (Byte?)ToByte(p);</from>
|
|
786 <from type="Binary" >return p == null || p.Length == 0? null: (Byte?)ToByte(p.ToArray());</from>
|
|
787 </group>
|
|
788 <default nullvalue="null">
|
|
789 if (p is IConvertible) return ((IConvertible)p).ToByte(null);
|
|
790 </default>
|
|
791 </converter>
|
|
792 <converter type="UInt16" nullable="true">
|
|
793 <group name="Scalar Types.">
|
|
794 <from type="UInt16" >return p;</from>
|
|
795 <from type="String" >return p == null? null: (UInt16?)UInt16.Parse(p);</from>
|
|
796 <br/>
|
|
797 <include template ="Numeric Types"/>
|
|
798 <from type="Char"/>
|
|
799 <from type="Boolean">return (UInt16?)(p? 1: 0);</from>
|
|
800 <default >return checked((UInt16?)p);</default>
|
|
801 </group>
|
|
802 <group name="Nullable Types." nullable="true">
|
|
803 <include template ="Numeric Types"/>
|
|
804 <from type="Char"/>
|
|
805 <from type="Boolean">return p.HasValue? (UInt16?)(p.Value? 1: 0): null;</from>
|
|
806 <default >return p.HasValue? checked((UInt16?)p.Value): null;</default>
|
|
807 </group>
|
|
808 <group name="SqlTypes">
|
|
809 <include template ="SqlTypes"/>
|
|
810 <default >return p.IsNull? null: ToNullableUInt16(p.Value);</default>
|
|
811 </group>
|
|
812 <group name="Other Types">
|
|
813 <from type="Byte[]" >return p == null || p.Length == 0? null: (UInt16?)ToUInt16(p);</from>
|
|
814 <from type="Binary" >return p == null || p.Length == 0? null: (UInt16?)ToUInt16(p.ToArray());</from>
|
|
815 </group>
|
|
816 <default nullvalue="null">
|
|
817 if (p is IConvertible) return ((IConvertible)p).ToUInt16(null);
|
|
818 </default>
|
|
819 </converter>
|
|
820 <converter type="UInt32" nullable="true">
|
|
821 <group name="Scalar Types.">
|
|
822 <from type="UInt32" >return p;</from>
|
|
823 <from type="String" >return p == null? null: (UInt32?)UInt32.Parse(p);</from>
|
|
824 <br/>
|
|
825 <include template ="Numeric Types"/>
|
|
826 <from type="Char"/>
|
|
827 <from type="Boolean">return (UInt32?)(p? 1: 0);</from>
|
|
828 <default >return checked((UInt32?)p);</default>
|
|
829 </group>
|
|
830 <group name="Nullable Types." nullable="true">
|
|
831 <include template ="Numeric Types"/>
|
|
832 <from type="Char"/>
|
|
833 <from type="Boolean">return p.HasValue? (UInt32?)(p.Value? 1: 0): null;</from>
|
|
834 <default >return p.HasValue? checked((UInt32?)p.Value): null;</default>
|
|
835 </group>
|
|
836 <group name="SqlTypes">
|
|
837 <include template ="SqlTypes"/>
|
|
838 <default >return p.IsNull? null: ToNullableUInt32(p.Value);</default>
|
|
839 </group>
|
|
840 <group name="Other Types">
|
|
841 <from type="Byte[]" >return p == null || p.Length == 0? null: (UInt32?)ToUInt32(p);</from>
|
|
842 <from type="Binary" >return p == null || p.Length == 0? null: (UInt32?)ToUInt32(p.ToArray());</from>
|
|
843 </group>
|
|
844 <default nullvalue="null">
|
|
845 if (p is IConvertible) return ((IConvertible)p).ToUInt32(null);
|
|
846 </default>
|
|
847 </converter>
|
|
848 <converter type="UInt64" nullable="true">
|
|
849 <group name="Scalar Types.">
|
|
850 <from type="UInt64" >return p;</from>
|
|
851 <from type="String" >return p == null? null: (UInt64?)UInt64.Parse(p);</from>
|
|
852 <br/>
|
|
853 <include template ="Numeric Types"/>
|
|
854 <from type="Char"/>
|
|
855 <from type="Boolean" >return (UInt64?)(p? 1: 0);</from>
|
|
856 <default >return checked((UInt64?)p);</default>
|
|
857 </group>
|
|
858 <group name="Nullable Types." nullable="true">
|
|
859 <include template ="Numeric Types"/>
|
|
860 <from type="Char"/>
|
|
861 <from type="Boolean" >return p.HasValue? (UInt64?)(p.Value? 1: 0): null;</from>
|
|
862 <default >return p.HasValue? checked((UInt64?)p.Value): null;</default>
|
|
863 </group>
|
|
864 <group name="SqlTypes">
|
|
865 <include template ="SqlTypes"/>
|
|
866 <default >return p.IsNull? null: ToNullableUInt64(p.Value);</default>
|
|
867 </group>
|
|
868 <group name="Other Types">
|
|
869 <from type="Byte[]" >return p == null || p.Length == 0? null: (UInt64?)ToUInt64(p);</from>
|
|
870 <from type="Binary" >return p == null || p.Length == 0? null: (UInt64?)ToUInt64(p.ToArray());</from>
|
|
871 </group>
|
|
872 <default nullvalue="null">
|
|
873 if (p is IConvertible) return ((IConvertible)p).ToUInt64(null);
|
|
874 </default>
|
|
875 </converter>
|
|
876 <br/>
|
|
877 <converter type="Char" nullable="true">
|
|
878 <group name="Scalar Types.">
|
|
879 <from type="Char" >return p;</from>
|
|
880 <from type="String">return p == null? null: (Char?)Char.Parse(p);</from>
|
|
881 <br/>
|
|
882 <include template ="Numeric Types"/>
|
|
883 <from type="Boolean">return (Char?)(p? 1: 0);</from>
|
|
884 <default >return checked((Char?)p);</default>
|
|
885 </group>
|
|
886 <group name="Nullable Types." nullable="true">
|
|
887 <include template ="Numeric Types"/>
|
|
888 <from type="Boolean" >return p.HasValue? (Char?)(p.Value? 1: 0): null;</from>
|
|
889 <default >return p.HasValue? checked((Char?)p.Value): null;</default>
|
|
890 </group>
|
|
891 <group name="SqlTypes">
|
|
892 <include template ="SqlTypes"/>
|
|
893 <default >return p.IsNull? null: ToNullableChar(p.Value);</default>
|
|
894 </group>
|
|
895 <group name="Other Types">
|
|
896 <from type="Byte[]" >return p == null || p.Length == 0? null: (Char?)ToChar(p);</from>
|
|
897 <from type="Binary" >return p == null || p.Length == 0? null: (Char?)ToChar(p.ToArray());</from>
|
|
898 </group>
|
|
899 <default nullvalue="null">
|
|
900 if (p is IConvertible) return ((IConvertible)p).ToChar(null);
|
|
901 </default>
|
|
902 </converter>
|
|
903 <converter type="Single" nullable="true">
|
|
904 <group name="Scalar Types.">
|
|
905 <from type="Single" >return p;</from>
|
|
906 <from type="String" >return p == null? null: (Single?)Single.Parse(p);</from>
|
|
907 <br/>
|
|
908 <include template ="Numeric Types"/>
|
|
909 <from type="Char"/>
|
|
910 <from type="Boolean">return p? 1.0f: 0.0f;</from>
|
|
911 <default >return checked((Single?)p);</default>
|
|
912 </group>
|
|
913 <group name="Nullable Types." nullable="true">
|
|
914 <include template ="Numeric Types"/>
|
|
915 <from type="Char"/>
|
|
916 <from type="Boolean">return p.HasValue? (Single?)(p.Value? 1.0f: 0.0f): null;</from>
|
|
917 <default >return p.HasValue? checked((Single?)p.Value): null;</default>
|
|
918 </group>
|
|
919 <group name="SqlTypes">
|
|
920 <from type="SqlSingle" >return p.IsNull? null: (Single?)p.Value; </from>
|
|
921 <include template ="SqlTypes"/>
|
|
922 <default >return p.IsNull? null: ToNullableSingle(p.Value);</default>
|
|
923 </group>
|
|
924 <group name="Other Types">
|
|
925 <from type="Byte[]" >return p == null || p.Length == 0? null: (Single?)ToSingle(p);</from>
|
|
926 <from type="Binary" >return p == null || p.Length == 0? null: (Single?)ToSingle(p.ToArray());</from>
|
|
927 </group>
|
|
928 <default nullvalue="null">
|
|
929 if (p is IConvertible) return ((IConvertible)p).ToSingle(null);
|
|
930 </default>
|
|
931 </converter>
|
|
932 <converter type="Double" nullable="true">
|
|
933 <group name="Scalar Types.">
|
|
934 <from type="Double" >return p;</from>
|
|
935 <from type="String" >return p == null? null: (Double?)Double.Parse(p);</from>
|
|
936 <br/>
|
|
937 <include template ="Numeric Types"/>
|
|
938 <from type="Char"/>
|
|
939 <from type="Boolean" >return p? 1.0: 0.0;</from>
|
|
940 <from type="DateTime" >return (p - DateTime.MinValue).TotalDays;</from>
|
|
941 <from type="DateTimeOffset" >return (p - DateTimeOffset.MinValue).TotalDays;</from>
|
|
942 <from type="TimeSpan" >return p.TotalDays;</from>
|
|
943 <default >return checked((Double?)p);</default>
|
|
944 </group>
|
|
945 <group name="Nullable Types." nullable="true">
|
|
946 <include template ="Numeric Types"/>
|
|
947 <from type="Char"/>
|
|
948 <from type="Boolean" >return p.HasValue? (Double?)(p.Value? 1.0: 0.0): null;</from>
|
|
949 <from type="DateTime" >return p.HasValue? (Double?)(p.Value - DateTime.MinValue).TotalDays: null;</from>
|
|
950 <from type="DateTimeOffset" >return p.HasValue? (Double?)(p.Value - DateTimeOffset.MinValue).TotalDays: null;</from>
|
|
951 <from type="TimeSpan" >return p.HasValue? (Double?)p.Value.TotalDays: null;</from>
|
|
952 <default >return p.HasValue? checked((Double?)p.Value): null;</default>
|
|
953 </group>
|
|
954 <group name="SqlTypes">
|
|
955 <from type="SqlDouble">return p.IsNull? null: (Double?)p.Value; </from>
|
|
956 <include template ="SqlTypes"/>
|
|
957 <from type="SqlDateTime">return p.IsNull? null: (Double?)(p.Value - DateTime.MinValue).TotalDays;</from>
|
|
958 <default >return p.IsNull? null: ToNullableDouble(p.Value);</default>
|
|
959 </group>
|
|
960 <group name="Other Types">
|
|
961 <from type="Byte[]" >return p == null || p.Length == 0? null: (Double?)ToDouble(p);</from>
|
|
962 <from type="Binary" >return p == null || p.Length == 0? null: (Double?)ToDouble(p.ToArray());</from>
|
|
963 </group>
|
|
964 <default nullvalue="null">
|
|
965 if (p is IConvertible) return ((IConvertible)p).ToDouble(null);
|
|
966 </default>
|
|
967 </converter>
|
|
968 <br/>
|
|
969 <converter type="Boolean" nullable="true">
|
|
970 <group name="Scalar Types.">
|
|
971 <from type="Boolean" >return p;</from>
|
|
972 <from type="String" >return p == null? null: (Boolean?)Boolean.Parse(p);</from>
|
|
973 <br/>
|
|
974 <include template ="Numeric Types"/>
|
|
975 <from type="Char" />
|
|
976 <default >return ToBoolean(p);</default>
|
|
977 </group>
|
|
978 <group name="Nullable Types." nullable="true">
|
|
979 <include template ="Numeric Types"/>
|
|
980 <from type="Char" />
|
|
981 <default >return p.HasValue? (Boolean?)ToBoolean(p.Value): null;</default>
|
|
982 </group>
|
|
983 <group name="SqlTypes">
|
|
984 <from type="SqlBoolean">return p.IsNull? null: (Boolean?) p.Value; </from>
|
|
985 <include template ="SqlTypes"/>
|
|
986 <default >return p.IsNull? null: (Boolean?)ToBoolean(p.Value);</default>
|
|
987 </group>
|
|
988 <group name="Other Types">
|
|
989 <from type="Byte[]" >return p == null || p.Length == 0? null: (Boolean?)ToBoolean(p);</from>
|
|
990 <from type="Binary" >return p == null || p.Length == 0? null: (Boolean?)ToBoolean(p.ToArray());</from>
|
|
991 </group>
|
|
992 <default nullvalue="null">
|
|
993 if (p is IConvertible) return ((IConvertible)p).ToBoolean(null);
|
|
994 </default>
|
|
995 </converter>
|
|
996 <converter type="Decimal" nullable="true">
|
|
997 <group name="Scalar Types.">
|
|
998 <from type="Decimal" >return p;</from>
|
|
999 <from type="String" >return p == null? null: (Decimal?)Decimal.Parse(p);</from>
|
|
1000 <br/>
|
|
1001 <include template ="Numeric Types"/>
|
|
1002 <from type="Char"/>
|
|
1003 <from type="Boolean">return p? 1.0m: 0.0m;</from>
|
|
1004 <default >return checked((Decimal?)p);</default>
|
|
1005 </group>
|
|
1006 <group name="Nullable Types." nullable="true">
|
|
1007 <include template ="Numeric Types"/>
|
|
1008 <from type="Char"/>
|
|
1009 <from type="Boolean">return p.HasValue? (Decimal?)(p.Value? 1.0m: 0.0m): null;</from>
|
|
1010 <default >return p.HasValue? checked((Decimal?)p.Value): null;</default>
|
|
1011 </group>
|
|
1012 <group name="SqlTypes">
|
|
1013 <from type="SqlDecimal">return p.IsNull? null: (Decimal?)p.Value; </from>
|
|
1014 <from type="SqlMoney" >return p.IsNull? null: (Decimal?)p.Value; </from>
|
|
1015 <include template ="SqlTypes"/>
|
|
1016 <default >return p.IsNull? null: ToNullableDecimal(p.Value);</default>
|
|
1017 </group>
|
|
1018 <group name="Other Types">
|
|
1019 <from type="Byte[]" >return p == null || p.Length == 0? null: (Decimal?)ToDecimal(p);</from>
|
|
1020 <from type="Binary" >return p == null || p.Length == 0? null: (Decimal?)ToDecimal(p.ToArray());</from>
|
|
1021 </group>
|
|
1022 <default nullvalue="null">
|
|
1023 if (p is IConvertible) return ((IConvertible)p).ToDecimal(null);
|
|
1024 </default>
|
|
1025 </converter>
|
|
1026 <converter type="DateTime" nullable="true">
|
|
1027 <group name="Scalar Types.">
|
|
1028 <from type="DateTime">return p;</from>
|
|
1029 <from type="DateTimeOffset">return p.LocalDateTime;</from>
|
|
1030 <from type="String" >return p == null? null: (DateTime?)DateTime.Parse(p);</from>
|
|
1031 <br/>
|
|
1032 <from type="TimeSpan" >return DateTime.MinValue + p;</from>
|
|
1033 <from type="Int64" >return DateTime.MinValue + TimeSpan.FromTicks(p);</from>
|
|
1034 <from type="Double" >return DateTime.MinValue + TimeSpan.FromDays(p);</from>
|
|
1035 </group>
|
|
1036 <group name="Nullable Types." nullable="true">
|
|
1037 <from type="TimeSpan" >return p.HasValue? DateTime.MinValue + p.Value: (DateTime?)null;</from>
|
|
1038 <from type="Int64" >return p.HasValue? DateTime.MinValue + TimeSpan.FromTicks(p.Value): (DateTime?)null;</from>
|
|
1039 <from type="Double" >return p.HasValue? DateTime.MinValue + TimeSpan.FromDays(p.Value): (DateTime?)null;</from>
|
|
1040 <from type="DateTimeOffset">return p.HasValue? p.Value.LocalDateTime: (DateTime?)null;</from>
|
|
1041 </group>
|
|
1042 <group name="SqlTypes">
|
|
1043 <from type="SqlDateTime">return p.IsNull? (DateTime?)null: p.Value; </from>
|
|
1044 <from type="SqlString" >return p.IsNull? (DateTime?)null: ToDateTime(p.Value);</from>
|
|
1045 <from type="SqlInt64" >return p.IsNull? (DateTime?)null: DateTime.MinValue + TimeSpan.FromTicks(p.Value);</from>
|
|
1046 <from type="SqlDouble" >return p.IsNull? (DateTime?)null: DateTime.MinValue + TimeSpan.FromDays(p.Value);</from>
|
|
1047 </group>
|
|
1048 <group name="Other Types">
|
|
1049 <from type="Byte[]" >return p == null || p.Length == 0? null: (DateTime?)ToDateTime(p);</from>
|
|
1050 <from type="Binary" >return p == null || p.Length == 0? null: (DateTime?)ToDateTime(p.ToArray());</from>
|
|
1051 </group>
|
|
1052 <default nullvalue="null">
|
|
1053 if (p is IConvertible) return ((IConvertible)p).ToDateTime(null);
|
|
1054 </default>
|
|
1055 </converter>
|
|
1056 <converter type="DateTimeOffset" nullable="true">
|
|
1057 <group name="Scalar Types.">
|
|
1058 <from type="DateTime">return p;</from>
|
|
1059 <from type="DateTimeOffset">return p;</from>
|
|
1060 <from type="String" >return p == null? null: (DateTimeOffset?)DateTimeOffset.Parse(p);</from>
|
|
1061 <br/>
|
|
1062 <from type="TimeSpan" >return DateTimeOffset.MinValue + p;</from>
|
|
1063 <from type="Int64" >return DateTimeOffset.MinValue + TimeSpan.FromTicks(p);</from>
|
|
1064 <from type="Double" >return DateTimeOffset.MinValue + TimeSpan.FromDays(p);</from>
|
|
1065 </group>
|
|
1066 <group name="Nullable Types." nullable="true">
|
|
1067 <from type="TimeSpan" >return p.HasValue? DateTimeOffset.MinValue + p.Value: (DateTimeOffset?)null;</from>
|
|
1068 <from type="Int64" >return p.HasValue? DateTimeOffset.MinValue + TimeSpan.FromTicks(p.Value): (DateTimeOffset?)null;</from>
|
|
1069 <from type="Double" >return p.HasValue? DateTimeOffset.MinValue + TimeSpan.FromDays(p.Value): (DateTimeOffset?)null;</from>
|
|
1070 <from type="DateTime">return p.HasValue? p: null;</from>
|
|
1071 </group>
|
|
1072 <group name="SqlTypes">
|
|
1073 <from type="SqlDateTime">return p.IsNull? (DateTimeOffset?)null: p.Value; </from>
|
|
1074 <from type="SqlString" >return p.IsNull? (DateTimeOffset?)null: ToDateTimeOffset(p.Value);</from>
|
|
1075 <from type="SqlInt64" >return p.IsNull? (DateTimeOffset?)null: DateTimeOffset.MinValue + TimeSpan.FromTicks(p.Value);</from>
|
|
1076 <from type="SqlDouble" >return p.IsNull? (DateTimeOffset?)null: DateTimeOffset.MinValue + TimeSpan.FromDays(p.Value);</from>
|
|
1077 </group>
|
|
1078 <group name="Other Types">
|
|
1079 <from type="Byte[]" >return p == null || p.Length == 0? null: (DateTimeOffset?)ToDateTimeOffset(p);</from>
|
|
1080 <from type="Binary" >return p == null || p.Length == 0? null: (DateTimeOffset?)ToDateTimeOffset(p.ToArray());</from>
|
|
1081 </group>
|
|
1082 <default nullvalue="null">
|
|
1083 if (p is IConvertible) return ToDateTimeOffset(((IConvertible)p).ToDateTime(null));
|
|
1084 </default>
|
|
1085 </converter>
|
|
1086 <converter type="TimeSpan" nullable="true">
|
|
1087 <group name="Scalar Types.">
|
|
1088 <from type="TimeSpan" >return p;</from>
|
|
1089 <from type="String" >return p == null? null: (TimeSpan?)TimeSpan.Parse(p);</from>
|
|
1090 <from type="DateTime" >return p - DateTime.MinValue;</from>
|
|
1091 <from type="DateTimeOffset">return p - DateTimeOffset.MinValue;</from>
|
|
1092 <from type="Int64" >return TimeSpan.FromTicks(p);</from>
|
|
1093 <from type="Double" >return TimeSpan.FromDays(p);</from>
|
|
1094 </group>
|
|
1095
|
|
1096 <group name="Nullable Types." nullable="true">
|
|
1097 <from type="DateTime" >return p.HasValue? p.Value - DateTime.MinValue: (TimeSpan?)null;</from>
|
|
1098 <from type="DateTimeOffset" >return p.HasValue? p.Value - DateTimeOffset.MinValue: (TimeSpan?)null;</from>
|
|
1099 <from type="Int64" >return p.HasValue? TimeSpan.FromTicks(p.Value): (TimeSpan?)null;</from>
|
|
1100 <from type="Double" >return p.HasValue? TimeSpan.FromDays(p.Value): (TimeSpan?)null;</from>
|
|
1101 </group>
|
|
1102
|
|
1103 <group name="SqlTypes">
|
|
1104 <from type="SqlString" >return p.IsNull? (TimeSpan?)null: TimeSpan.Parse(p.Value); </from>
|
|
1105 <from type="SqlDateTime">return p.IsNull? (TimeSpan?)null: p.Value - DateTime.MinValue;</from>
|
|
1106 <from type="SqlInt64" >return p.IsNull? (TimeSpan?)null: TimeSpan.FromTicks(p.Value);</from>
|
|
1107 <from type="SqlDouble" >return p.IsNull? (TimeSpan?)null: TimeSpan.FromDays(p.Value);</from>
|
|
1108 </group>
|
|
1109 <group name="Other Types">
|
|
1110 <from type="Byte[]" >return p == null || p.Length == 0? null: (TimeSpan?)ToTimeSpan(p);</from>
|
|
1111 <from type="Binary" >return p == null || p.Length == 0? null: (TimeSpan?)ToTimeSpan(p.ToArray());</from>
|
|
1112 </group>
|
|
1113 <default nullvalue="null"/>
|
|
1114 </converter>
|
|
1115 <converter type="Guid" nullable="true">
|
|
1116 <group name="Scalar Types.">
|
|
1117 <from type="Guid" >return p;</from>
|
|
1118 <from type="String" >return p == null? null: (Guid?)new Guid(p);</from>
|
|
1119 </group>
|
|
1120 <group name="SqlTypes">
|
|
1121 <from type="SqlGuid" >return p.IsNull? null: (Guid?)p.Value; </from>
|
|
1122 <from type="SqlString">return p.IsNull? null: (Guid?)new Guid(p.Value); </from>
|
|
1123 <from type="SqlBinary">return p.IsNull? null: (Guid?)p.ToSqlGuid().Value;</from>
|
|
1124 </group>
|
|
1125 <group name="Other Types.">
|
|
1126 <from type="Type" >return p == null? null: (Guid?)p.GUID;</from>
|
|
1127 <from type="Byte[]" >return p == null? null: (Guid?)new Guid(p);</from>
|
|
1128 <from type="Binary" >return p == null? null: (Guid?)new Guid(p.ToArray());</from>
|
|
1129 </group>
|
|
1130 <default nullvalue="null"/>
|
|
1131 </converter>
|
|
1132 </region>
|
|
1133 <region name="SqlTypes">
|
|
1134 <converter type="SqlString">
|
|
1135 <group name="Scalar Types.">
|
|
1136 <from type="String" >return p ?? SqlString.Null;</from>
|
|
1137 <br/>
|
|
1138 <include template ="Numeric Types"/>
|
|
1139 <from type="Char" />
|
|
1140 <from type="TimeSpan"/>
|
|
1141 <from type="DateTime"/>
|
|
1142 <from type="DateTimeOffset"/>
|
|
1143 <from type="Guid" />
|
|
1144 <from type="Char[]" >return new String(p);</from>
|
|
1145 <default >return p.ToString();</default>
|
|
1146 </group>
|
|
1147
|
|
1148 <group name="Nullable Types." nullable="true">
|
|
1149 <include template ="Numeric Types"/>
|
|
1150 <from type="Char" />
|
|
1151 <from type="TimeSpan"/>
|
|
1152 <from type="DateTime"/>
|
|
1153 <from type="DateTimeOffset"/>
|
|
1154 <from type="Guid" />
|
|
1155 <default >return p.HasValue? p.ToString(): SqlString.Null;</default>
|
|
1156 </group>
|
|
1157
|
|
1158 <group name="SqlTypes">
|
|
1159 <include template="SqlTypes"/>
|
|
1160 <from type="SqlChars"/>
|
|
1161 <from type="SqlXml">return p.IsNull? SqlString.Null: p.Value;</from>
|
|
1162 <from type="SqlGuid" />
|
|
1163 <from type="SqlDateTime"/>
|
|
1164 <default >return p.ToSqlString();</default>
|
|
1165 </group>
|
|
1166 <group name="Other Types">
|
|
1167 <from type="Type" >return p == null? SqlString.Null: p.FullName;</from>
|
|
1168 <from type="XmlDocument">return p == null? SqlString.Null: p.InnerXml;</from>
|
|
1169 <from type="Byte[]" >return p == null || p.Length == 0? SqlString.Null: new SqlString(ToString(p));</from>
|
|
1170 <from type="Binary" >return p == null || p.Length == 0? SqlString.Null: new SqlString(ToString(p.ToArray()));</from>
|
|
1171 </group>
|
|
1172 <default nullvalue="SqlString.Null" nothrow="true">
|
|
1173 return ToString(p);</default>
|
|
1174 </converter>
|
|
1175 <br/>
|
|
1176 <converter type="SqlByte">
|
|
1177 <group name="Scalar Types.">
|
|
1178 <from type="Byte" >return p;</from>
|
|
1179 <from type="String" >return p == null? SqlByte.Null: SqlByte.Parse(p);</from>
|
|
1180 <br/>
|
|
1181 <include template ="Numeric Types"/>
|
|
1182 <from type="Char"/>
|
|
1183 <from type="Boolean" >return (Byte)(p? 1: 0);</from>
|
|
1184 <default >return checked((Byte)p);</default>
|
|
1185 </group>
|
|
1186
|
|
1187 <group name="Nullable Types." nullable="true">
|
|
1188 <from type="Byte" >return p.HasValue? p.Value: SqlByte.Null;</from>
|
|
1189 <include template ="Numeric Types"/>
|
|
1190 <from type="Char"/>
|
|
1191 <default >return p.HasValue? ToByte(p.Value): SqlByte.Null;</default>
|
|
1192 </group>
|
|
1193
|
|
1194 <group name="SqlTypes">
|
|
1195 <include template="SqlTypes"/>
|
|
1196 <from type="SqlDateTime">return p.IsNull? SqlByte.Null: ToByte(p.Value);</from>
|
|
1197 <default >return p.ToSqlByte();</default>
|
|
1198 </group>
|
|
1199 <group name="Other Types">
|
|
1200 <from type="Byte[]" >return p == null || p.Length == 0? SqlByte.Null: new SqlByte(ToByte(p));</from>
|
|
1201 <from type="Binary" >return p == null || p.Length == 0? SqlByte.Null: new SqlByte(ToByte(p.ToArray()));</from>
|
|
1202 </group>
|
|
1203 <default nullvalue="SqlByte.Null" nothrow="true">
|
|
1204 return ToByte(p);</default>
|
|
1205 </converter>
|
|
1206 <converter type="SqlInt16">
|
|
1207 <group name="Scalar Types.">
|
|
1208 <from type="Int16" >return p;</from>
|
|
1209 <from type="String" >return p == null? SqlInt16.Null: SqlInt16.Parse(p);</from>
|
|
1210 <br/>
|
|
1211 <include template ="Numeric Types"/>
|
|
1212 <from type="Char"/>
|
|
1213 <from type="Boolean" >return (Int16)(p? 1: 0);</from>
|
|
1214 <default >return checked((Int16)p);</default>
|
|
1215 </group>
|
|
1216
|
|
1217 <group name="Nullable Types." nullable="true">
|
|
1218 <from type="Int16" >return p.HasValue? p.Value: SqlInt16.Null;</from>
|
|
1219 <include template ="Numeric Types"/>
|
|
1220 <from type="Char"/>
|
|
1221 <default >return p.HasValue? ToInt16(p.Value): SqlInt16.Null;</default>
|
|
1222 </group>
|
|
1223
|
|
1224 <group name="SqlTypes">
|
|
1225 <include template="SqlTypes"/>
|
|
1226 <from type="SqlDateTime">return p.IsNull? SqlInt16.Null: ToInt16(p.Value);</from>
|
|
1227 <default >return p.ToSqlInt16();</default>
|
|
1228 </group>
|
|
1229 <group name="Other Types">
|
|
1230 <from type="Byte[]" >return p == null || p.Length == 0? SqlInt16.Null: new SqlInt16(ToInt16(p));</from>
|
|
1231 <from type="Binary" >return p == null || p.Length == 0? SqlInt16.Null: new SqlInt16(ToInt16(p.ToArray()));</from>
|
|
1232 </group>
|
|
1233 <default nullvalue="SqlInt16.Null" nothrow="true">
|
|
1234 return ToInt16(p);</default>
|
|
1235 </converter>
|
|
1236 <converter type="SqlInt32">
|
|
1237 <group name="Scalar Types.">
|
|
1238 <from type="Int32" >return p;</from>
|
|
1239 <from type="String" >return p == null? SqlInt32.Null: SqlInt32.Parse(p);</from>
|
|
1240 <br/>
|
|
1241 <include template ="Numeric Types"/>
|
|
1242 <from type="Char"/>
|
|
1243 <from type="Boolean" >return p? 1: 0;</from>
|
|
1244 <default >return checked((Int32)p);</default>
|
|
1245 </group>
|
|
1246
|
|
1247 <group name="Nullable Types." nullable="true">
|
|
1248 <from type="Int32" >return p.HasValue? p.Value: SqlInt32.Null;</from>
|
|
1249 <include template ="Numeric Types"/>
|
|
1250 <from type="Char"/>
|
|
1251 <default >return p.HasValue? ToInt32(p.Value): SqlInt32.Null;</default>
|
|
1252 </group>
|
|
1253
|
|
1254 <group name="SqlTypes">
|
|
1255 <include template="SqlTypes"/>
|
|
1256 <from type="SqlDateTime">return p.IsNull? SqlInt32.Null: ToInt32(p.Value);</from>
|
|
1257 <default >return p.ToSqlInt32();</default>
|
|
1258 </group>
|
|
1259 <group name="Other Types">
|
|
1260 <from type="Byte[]" >return p == null || p.Length == 0? SqlInt32.Null: new SqlInt32(ToInt32(p));</from>
|
|
1261 <from type="Binary" >return p == null || p.Length == 0? SqlInt32.Null: new SqlInt32(ToInt32(p.ToArray()));</from>
|
|
1262 </group>
|
|
1263 <default nullvalue="SqlInt32.Null" nothrow="true">
|
|
1264 return ToInt32(p);</default>
|
|
1265 </converter>
|
|
1266 <converter type="SqlInt64">
|
|
1267 <group name="Scalar Types.">
|
|
1268 <from type="Int64" >return p;</from>
|
|
1269 <from type="String" >return p == null? SqlInt64.Null: SqlInt64.Parse(p);</from>
|
|
1270 <br/>
|
|
1271 <include template ="Numeric Types"/>
|
|
1272 <from type="Char"/>
|
|
1273 <from type="Boolean" >return p? 1: 0;</from>
|
|
1274 <from type="DateTime" >return (p - DateTime.MinValue).Ticks;</from>
|
|
1275 <from type="DateTimeOffset" >return (p - DateTimeOffset.MinValue).Ticks;</from>
|
|
1276 <from type="TimeSpan" >return p.Ticks;</from>
|
|
1277 <default >return checked((Int64)p);</default>
|
|
1278 </group>
|
|
1279
|
|
1280 <group name="Nullable Types." nullable="true">
|
|
1281 <from type="Int64" >return p.HasValue? p.Value: SqlInt64.Null;</from>
|
|
1282 <include template ="Numeric Types"/>
|
|
1283 <from type="Char"/>
|
|
1284 <from type="DateTime"/>
|
|
1285 <from type="DateTimeOffset"/>
|
|
1286 <from type="TimeSpan"/>
|
|
1287 <default >return p.HasValue? ToInt64(p.Value): SqlInt64.Null;</default>
|
|
1288 </group>
|
|
1289
|
|
1290 <group name="SqlTypes">
|
|
1291 <include template="SqlTypes"/>
|
|
1292 <from type="SqlDateTime">return p.IsNull? SqlInt64.Null: ToInt64(p.Value);</from>
|
|
1293 <default >return p.ToSqlInt64();</default>
|
|
1294 </group>
|
|
1295 <group name="Other Types">
|
|
1296 <from type="Byte[]" >return p == null || p.Length == 0? SqlInt64.Null: new SqlInt64(ToInt64(p));</from>
|
|
1297 <from type="Binary" >return p == null || p.Length == 0? SqlInt64.Null: new SqlInt64(ToInt64(p.ToArray()));</from>
|
|
1298 </group>
|
|
1299 <default nullvalue="SqlInt64.Null" nothrow="true">
|
|
1300 return ToInt64(p);</default>
|
|
1301 </converter>
|
|
1302 <br/>
|
|
1303 <converter type="SqlSingle">
|
|
1304 <group name="Scalar Types.">
|
|
1305 <from type="Single" >return p;</from>
|
|
1306 <from type="String" >return p == null? SqlSingle.Null: SqlSingle.Parse(p);</from>
|
|
1307 <br/>
|
|
1308 <include template ="Numeric Types"/>
|
|
1309 <from type="Char"/>
|
|
1310 <from type="Boolean" >return p? 1.0f: 0.0f;</from>
|
|
1311 <default >return checked((Single)p);</default>
|
|
1312 </group>
|
|
1313
|
|
1314 <group name="Nullable Types." nullable="true">
|
|
1315 <from type="Single" >return p.HasValue? p.Value: SqlSingle.Null;</from>
|
|
1316 <include template ="Numeric Types"/>
|
|
1317 <default >return p.HasValue? ToSingle(p.Value): SqlSingle.Null;</default>
|
|
1318 </group>
|
|
1319
|
|
1320 <group name="SqlTypes">
|
|
1321 <include template="SqlTypes"/>
|
|
1322 <default >return p.ToSqlSingle();</default>
|
|
1323 </group>
|
|
1324 <group name="Other Types">
|
|
1325 <from type="Byte[]" >return p == null || p.Length == 0? SqlSingle.Null: new SqlSingle(ToSingle(p));</from>
|
|
1326 <from type="Binary" >return p == null || p.Length == 0? SqlSingle.Null: new SqlSingle(ToSingle(p.ToArray()));</from>
|
|
1327 </group>
|
|
1328 <default nullvalue="SqlSingle.Null" nothrow="true">
|
|
1329 return ToSingle(p);</default>
|
|
1330 </converter>
|
|
1331 <converter type="SqlDouble">
|
|
1332 <group name="Scalar Types.">
|
|
1333 <from type="Double" >return p;</from>
|
|
1334 <from type="String" >return p == null? SqlDouble.Null: SqlDouble.Parse(p);</from>
|
|
1335 <br/>
|
|
1336 <include template ="Numeric Types"/>
|
|
1337 <from type="Char"/>
|
|
1338 <from type="Boolean" >return p? 1.0: 0.0;</from>
|
|
1339 <from type="DateTime" >return (p - DateTime.MinValue).TotalDays;</from>
|
|
1340 <from type="DateTimeOffset" >return (p - DateTimeOffset.MinValue).TotalDays;</from>
|
|
1341 <from type="TimeSpan" >return p.TotalDays;</from>
|
|
1342 <default >return checked((Double)p);</default>
|
|
1343 </group>
|
|
1344
|
|
1345 <group name="Nullable Types." nullable="true">
|
|
1346 <from type="Double" >return p.HasValue? p.Value: SqlDouble.Null;</from>
|
|
1347 <include template ="Numeric Types"/>
|
|
1348 <from type="DateTime"/>
|
|
1349 <from type="DateTimeOffset"/>
|
|
1350 <from type="TimeSpan"/>
|
|
1351 <default >return p.HasValue? ToDouble(p.Value): SqlDouble.Null;</default>
|
|
1352 </group>
|
|
1353
|
|
1354 <group name="SqlTypes">
|
|
1355 <include template="SqlTypes"/>
|
|
1356 <from type="SqlDateTime">return p.IsNull? SqlDouble.Null: ToDouble(p.Value);</from>
|
|
1357 <default >return p.ToSqlDouble();</default>
|
|
1358 </group>
|
|
1359 <group name="Other Types">
|
|
1360 <from type="Byte[]" >return p == null || p.Length == 0? SqlDouble.Null: new SqlDouble(ToDouble(p));</from>
|
|
1361 <from type="Binary" >return p == null || p.Length == 0? SqlDouble.Null: new SqlDouble(ToDouble(p.ToArray()));</from>
|
|
1362 </group>
|
|
1363 <default nullvalue="SqlDouble.Null" nothrow="true">
|
|
1364 return ToDouble(p);</default>
|
|
1365 </converter>
|
|
1366 <converter type="SqlDecimal">
|
|
1367 <group name="Scalar Types.">
|
|
1368 <from type="Decimal" >return p;</from>
|
|
1369 <from type="String" >return p == null? SqlDecimal.Null: SqlDecimal.Parse(p);</from>
|
|
1370 <br/>
|
|
1371 <include template ="Numeric Types"/>
|
|
1372 <from type="Char"/>
|
|
1373 <from type="Boolean" >return p? 1.0m: 0.0m;</from>
|
|
1374 <default >return checked((Decimal)p);</default>
|
|
1375 </group>
|
|
1376
|
|
1377 <group name="Nullable Types." nullable="true">
|
|
1378 <from type="Decimal" >return p.HasValue? p.Value: SqlDecimal.Null;</from>
|
|
1379 <include template ="Numeric Types"/>
|
|
1380 <default >return p.HasValue? ToDecimal(p.Value): SqlDecimal.Null;</default>
|
|
1381 </group>
|
|
1382
|
|
1383 <group name="SqlTypes">
|
|
1384 <include template="SqlTypes"/>
|
|
1385 <default >return p.ToSqlDecimal();</default>
|
|
1386 </group>
|
|
1387 <group name="Other Types">
|
|
1388 <from type="Byte[]" >return p == null || p.Length == 0? SqlDecimal.Null: new SqlDecimal(ToDecimal(p));</from>
|
|
1389 <from type="Binary" >return p == null || p.Length == 0? SqlDecimal.Null: new SqlDecimal(ToDecimal(p.ToArray()));</from>
|
|
1390 </group>
|
|
1391 <default nullvalue="SqlDecimal.Null" nothrow="true">
|
|
1392 return ToDecimal(p);</default>
|
|
1393 </converter>
|
|
1394 <converter type="SqlMoney">
|
|
1395 <group name="Scalar Types.">
|
|
1396 <from type="Decimal" >return p;</from>
|
|
1397 <from type="String" >return p == null? SqlMoney.Null: SqlMoney.Parse(p);</from>
|
|
1398 <br/>
|
|
1399 <include template ="Numeric Types"/>
|
|
1400 <from type="Char"/>
|
|
1401 <from type="Boolean" >return p? 1.0m: 0.0m;</from>
|
|
1402 <default >return checked((Decimal)p);</default>
|
|
1403 </group>
|
|
1404
|
|
1405 <group name="Nullable Types." nullable="true">
|
|
1406 <from type="Decimal" >return p.HasValue? p.Value: SqlMoney.Null;</from>
|
|
1407 <include template ="Numeric Types"/>
|
|
1408 <default >return p.HasValue? ToDecimal(p.Value): SqlMoney.Null;</default>
|
|
1409 </group>
|
|
1410
|
|
1411 <group name="SqlTypes">
|
|
1412 <include template="SqlTypes"/>
|
|
1413 <default >return p.ToSqlMoney();</default>
|
|
1414 </group>
|
|
1415 <group name="Other Types">
|
|
1416 <from type="Byte[]" >return p == null || p.Length == 0? SqlMoney.Null: new SqlMoney(ToDecimal(p));</from>
|
|
1417 <from type="Binary" >return p == null || p.Length == 0? SqlMoney.Null: new SqlMoney(ToDecimal(p.ToArray()));</from>
|
|
1418 </group>
|
|
1419 <default nullvalue="SqlMoney.Null" nothrow="true">
|
|
1420 return ToDecimal(p);</default>
|
|
1421 </converter>
|
|
1422 <br/>
|
|
1423 <converter type="SqlBoolean">
|
|
1424 <group name="Scalar Types.">
|
|
1425 <from type="Boolean" >return p;</from>
|
|
1426 <from type="String" >return p == null? SqlBoolean.Null: SqlBoolean.Parse(p);</from>
|
|
1427 <br/>
|
|
1428 <include template ="Numeric Types"/>
|
|
1429 <from type="Char"/>
|
|
1430 <default >return p != 0;</default>
|
|
1431 </group>
|
|
1432
|
|
1433 <group name="Nullable Types." nullable="true">
|
|
1434 <from type="Boolean" >return p.HasValue? p.Value: SqlBoolean.Null;</from>
|
|
1435 <include template ="Numeric Types"/>
|
|
1436 <from type="Char" />
|
|
1437 <default >return p.HasValue? ToBoolean(p.Value): SqlBoolean.Null;</default>
|
|
1438 </group>
|
|
1439
|
|
1440 <group name="SqlTypes">
|
|
1441 <include template="SqlTypes"/>
|
|
1442 <default >return p.ToSqlBoolean();</default>
|
|
1443 </group>
|
|
1444 <group name="Other Types">
|
|
1445 <from type="Byte[]" >return p == null || p.Length == 0? SqlBoolean.Null: new SqlBoolean(ToBoolean(p));</from>
|
|
1446 <from type="Binary" >return p == null || p.Length == 0? SqlBoolean.Null: new SqlBoolean(ToBoolean(p.ToArray()));</from>
|
|
1447 </group>
|
|
1448 <default nullvalue="SqlBoolean.Null" nothrow="true">
|
|
1449 return ToBoolean(p);</default>
|
|
1450 </converter>
|
|
1451 <converter type="SqlDateTime">
|
|
1452 <group name="Scalar Types.">
|
|
1453 <from type="String" >return p == null? SqlDateTime.Null: SqlDateTime.Parse(p);</from>
|
|
1454 <from type="DateTime" >return p;</from>
|
|
1455 <from type="DateTimeOffset" >return p.LocalDateTime;</from>
|
|
1456 <from type="TimeSpan"/>
|
|
1457 <from type="Int64"/>
|
|
1458 <from type="Double"/>
|
|
1459 <default >return ToDateTime(p);</default>
|
|
1460 </group>
|
|
1461
|
|
1462 <group name="Nullable Types." nullable="true">
|
|
1463 <from type="DateTime">return p.HasValue? p.Value: SqlDateTime.Null;</from>
|
|
1464 <from type="DateTimeOffset">return p.HasValue? p.Value.LocalDateTime: SqlDateTime.Null;</from>
|
|
1465 <from type="TimeSpan"/>
|
|
1466 <from type="Int64"/>
|
|
1467 <from type="Double"/>
|
|
1468 <default >return p.HasValue? ToDateTime(p.Value): SqlDateTime.Null;</default>
|
|
1469 </group>
|
|
1470
|
|
1471 <group name="SqlTypes">
|
|
1472 <from type="SqlString">return p.ToSqlDateTime();</from>
|
|
1473 <from type="SqlInt64"/>
|
|
1474 <from type="SqlDouble"/>
|
|
1475 <default >return p.IsNull? SqlDateTime.Null: ToDateTime(p);</default>
|
|
1476 </group>
|
|
1477 <group name="Other Types">
|
|
1478 <from type="Byte[]" >return p == null || p.Length == 0? SqlDateTime.Null: new SqlDateTime(ToDateTime(p));</from>
|
|
1479 <from type="Binary" >return p == null || p.Length == 0? SqlDateTime.Null: new SqlDateTime(ToDateTime(p.ToArray()));</from>
|
|
1480 </group>
|
|
1481 <default nullvalue="SqlDateTime.Null" nothrow="true">
|
|
1482 return ToDateTime(p);</default>
|
|
1483 </converter>
|
|
1484 <converter type="SqlGuid">
|
|
1485 <group name="Scalar Types.">
|
|
1486 <from type="Guid" >return p;</from>
|
|
1487 <from type="String" >return p == null? SqlGuid.Null: SqlGuid.Parse(p);</from>
|
|
1488 </group>
|
|
1489 <group name="Nullable Types." nullable="true">
|
|
1490 <from type="Guid" >return p.HasValue? p.Value: SqlGuid.Null;</from>
|
|
1491 </group>
|
|
1492 <group name="SqlTypes">
|
|
1493 <from type="SqlBinary"/>
|
|
1494 <from type="SqlBytes" >return p.ToSqlBinary().ToSqlGuid();</from>
|
|
1495 <from type="SqlString"/>
|
|
1496 <default >return p.ToSqlGuid();</default>
|
|
1497 </group>
|
|
1498 <group name="Other Types.">
|
|
1499 <from type="Type" >return p == null? SqlGuid.Null: p.GUID;</from>
|
|
1500 <from type="Byte[]" >return p == null? SqlGuid.Null: new SqlGuid(p);</from>
|
|
1501 <from type="Binary" >return p == null? SqlGuid.Null: new SqlGuid(p.ToArray());</from>
|
|
1502 </group>
|
|
1503 <default nullvalue="SqlGuid.Null" nothrow="true">
|
|
1504 return ToGuid(p);</default>
|
|
1505 </converter>
|
|
1506 <converter type="SqlBinary">
|
|
1507 <group name="Scalar Types.">
|
|
1508 <from type="Byte[]" >return p;</from>
|
|
1509 <from type="Binary" >return p.ToArray();</from>
|
|
1510 <from type="Guid" >return p == Guid.Empty? SqlBinary.Null: new SqlGuid(p).ToSqlBinary();</from>
|
|
1511 </group>
|
|
1512 <group name="Nullable Types." nullable="true">
|
|
1513 <from type="Guid" >return p.HasValue? new SqlGuid(p.Value).ToSqlBinary(): SqlBinary.Null;</from>
|
|
1514 </group>
|
|
1515 <group name="SqlTypes">
|
|
1516 <from type="SqlBytes"/>
|
|
1517 <from type="SqlGuid"/>
|
|
1518 <default >return p.ToSqlBinary();</default>
|
|
1519 </group>
|
|
1520 <default nullvalue="SqlBinary.Null" nothrow="true">
|
|
1521 return ToByteArray(p);</default>
|
|
1522 </converter>
|
|
1523 <converter type="SqlBytes">
|
|
1524 <group name="Scalar Types.">
|
|
1525 <from type="Byte[]" >return p == null? SqlBytes.Null: new SqlBytes(p);</from>
|
|
1526 <from type="Binary" >return p == null? SqlBytes.Null: new SqlBytes(p.ToArray());</from>
|
|
1527 <from type="Stream" >return p == null? SqlBytes.Null: new SqlBytes(p);</from>
|
|
1528 <from type="Guid" >return p == Guid.Empty? SqlBytes.Null: new SqlBytes(p.ToByteArray());</from>
|
|
1529 </group>
|
|
1530 <group name="Nullable Types." nullable="true">
|
|
1531 <from type="Guid" >return p.HasValue? new SqlBytes(p.Value.ToByteArray()): SqlBytes.Null;</from>
|
|
1532 </group>
|
|
1533 <group name="SqlTypes">
|
|
1534 <from type="SqlBinary">return p.IsNull? SqlBytes.Null: new SqlBytes(p);</from>
|
|
1535 <from type="SqlGuid" >return p.IsNull? SqlBytes.Null: new SqlBytes(p.ToByteArray());</from>
|
|
1536 </group>
|
|
1537 <default nullvalue="SqlBytes.Null" nothrow="true">
|
|
1538 return new SqlBytes(ToByteArray(p));</default>
|
|
1539 </converter>
|
|
1540 <converter type="SqlChars">
|
|
1541 <group name="Scalar Types.">
|
|
1542 <from type="String">return p == null? SqlChars.Null: new SqlChars(p.ToCharArray());</from>
|
|
1543 <from type="Char[]">return p == null? SqlChars.Null: new SqlChars(p);</from>
|
|
1544 <from type="Byte[]">return p == null? SqlChars.Null: new SqlChars(ToCharArray(p));</from>
|
|
1545 <from type="Binary">return p == null? SqlChars.Null: new SqlChars(ToCharArray(p.ToArray()));</from>
|
|
1546 <br/>
|
|
1547 <include template ="Numeric Types"/>
|
|
1548 <from type="Char"/>
|
|
1549 <from type="TimeSpan"/>
|
|
1550 <from type="DateTime"/>
|
|
1551 <from type="DateTimeOffset"/>
|
|
1552 <from type="Guid" />
|
|
1553 <default>return new SqlChars(ToString(p).ToCharArray());</default>
|
|
1554 </group>
|
|
1555
|
|
1556 <group name="Nullable Types." nullable="true">
|
|
1557 <include template ="Numeric Types"/>
|
|
1558 <from type="Char" >return p.HasValue? new SqlChars(new Char[]{p.Value}) : SqlChars.Null;</from>
|
|
1559 <from type="TimeSpan"/>
|
|
1560 <from type="DateTime"/>
|
|
1561 <from type="DateTimeOffset"/>
|
|
1562 <from type="Guid" />
|
|
1563 <default >return p.HasValue? new SqlChars(p.ToString().ToCharArray()): SqlChars.Null;</default>
|
|
1564 </group>
|
|
1565
|
|
1566 <group name="SqlTypes">
|
|
1567 <from type="SqlString">return (SqlChars)p;</from>
|
|
1568 <include template="SqlTypes"/>
|
|
1569 <from type="SqlGuid" />
|
|
1570 <from type="SqlDateTime" />
|
|
1571 <from type="SqlBinary">return p.IsNull? SqlChars.Null: new SqlChars(p.ToString().ToCharArray());</from>
|
|
1572 <default >return (SqlChars)p.ToSqlString();</default>
|
|
1573 </group>
|
|
1574 <from type="Type" >return p == null? SqlChars.Null: new SqlChars(p.FullName.ToCharArray());</from>
|
|
1575 <default nullvalue="SqlChars.Null" nothrow="true">
|
|
1576 return new SqlChars(ToString(p).ToCharArray());</default>
|
|
1577 </converter>
|
|
1578 <converter type="SqlXml">
|
|
1579 <group name="Scalar Types.">
|
|
1580 <from type="String" >return p == null? SqlXml.Null: new SqlXml(new XmlTextReader(new StringReader(p)));</from>
|
|
1581 <br/>
|
|
1582 <from type="Stream" />
|
|
1583 <from type="XmlReader"/>
|
|
1584 <from type="XmlDocument">return p == null? SqlXml.Null: new SqlXml(new XmlTextReader(new StringReader(p.InnerXml)));</from>
|
|
1585 <br/>
|
|
1586 <from type="Char[]" >return p == null? SqlXml.Null: new SqlXml(new XmlTextReader(new StringReader(new string(p))));</from>
|
|
1587 <from type="Byte[]" >return p == null? SqlXml.Null: new SqlXml(new MemoryStream(p));</from>
|
|
1588 <from type="Binary" >return p == null? SqlXml.Null: new SqlXml(new MemoryStream(p.ToArray()));</from>
|
|
1589 <default >return p == null? SqlXml.Null: new SqlXml(p);</default>
|
|
1590 </group>
|
|
1591 <group name="SqlTypes">
|
|
1592 <from type="SqlString">return p.IsNull? SqlXml.Null: new SqlXml(new XmlTextReader(new StringReader(p.Value)));</from>
|
|
1593 <from type="SqlChars" >return p.IsNull? SqlXml.Null: new SqlXml(new XmlTextReader(new StringReader(p.ToSqlString().Value)));</from>
|
|
1594 <from type="SqlBinary">return p.IsNull? SqlXml.Null: new SqlXml(new MemoryStream(p.Value));</from>
|
|
1595 <from type="SqlBytes" >return p.IsNull? SqlXml.Null: new SqlXml(p.Stream);</from>
|
|
1596 </group>
|
|
1597 <default nullvalue="SqlXml.Null"/>
|
|
1598 </converter>
|
|
1599 </region>
|
|
1600 <region name="Other Types">
|
|
1601 <converter type="Type">
|
|
1602 <group name="Scalar Types.">
|
|
1603 <from type="String" >return p == null? null: Type.GetType(p); </from>
|
|
1604 <from type="Char[]" >return p == null? null: Type.GetType(new string(p)); </from>
|
|
1605 <from type="Byte[]" >return p == null? null: Type.GetTypeFromCLSID(ToGuid(p)); </from>
|
|
1606 <from type="Binary" >return p == null? null: Type.GetTypeFromCLSID(ToGuid(p.ToArray())); </from>
|
|
1607 <from type="Guid" >return p == Guid.Empty? null: Type.GetTypeFromCLSID(p); </from>
|
|
1608 </group>
|
|
1609 <group name="Nullable Types." nullable="true">
|
|
1610 <from type="Guid" >return p.HasValue? Type.GetTypeFromCLSID(p.Value): null;</from>
|
|
1611 </group>
|
|
1612 <group name="SqlTypes">
|
|
1613 <from type="SqlString">return p.IsNull ? null: Type.GetType(p.Value); </from>
|
|
1614 <from type="SqlChars" >return p.IsNull ? null: Type.GetType(new string(p.Value));</from>
|
|
1615 <from type="SqlGuid" >return p.IsNull ? null: Type.GetTypeFromCLSID(p.Value); </from>
|
|
1616 </group>
|
|
1617 <default nullvalue="null"/>
|
|
1618 </converter>
|
|
1619 <converter type="Stream">
|
|
1620 <group name="Scalar Types.">
|
|
1621 <from type="Guid" >return p == Guid.Empty? Stream.Null: new MemoryStream(p.ToByteArray());</from>
|
|
1622 <from type="Byte[]" >return p == null? Stream.Null: new MemoryStream(p);</from>
|
|
1623 <from type="Binary" >return p == null? Stream.Null: new MemoryStream(p.ToArray());</from>
|
|
1624 </group>
|
|
1625 <group name="Nullable Types." nullable="true">
|
|
1626 <from type="Guid" >return p.HasValue? new MemoryStream(p.Value.ToByteArray()): Stream.Null;</from>
|
|
1627 </group>
|
|
1628 <group name="SqlTypes">
|
|
1629 <from type="SqlBytes" >return p.IsNull? Stream.Null: p.Stream; </from>
|
|
1630 <from type="SqlBinary">return p.IsNull? Stream.Null: new MemoryStream(p.Value);</from>
|
|
1631 <from type="SqlGuid" >return p.IsNull? Stream.Null: new MemoryStream(p.Value.ToByteArray());</from>
|
|
1632 </group>
|
|
1633 <default nullvalue="Stream.Null"/>
|
|
1634 </converter>
|
|
1635
|
|
1636 <converter type="Byte[]" name="ByteArray">
|
|
1637 <group name="Scalar Types.">
|
|
1638 <from type="String" >return p == null? null: System.Text.Encoding.UTF8.GetBytes(p);</from>
|
|
1639 <from type="Byte" >return new byte[]{p};</from>
|
|
1640 <from type="SByte" >return new byte[]{checked((Byte)p)};</from>
|
|
1641 <from type="Decimal">
|
|
1642 int[] bits = Decimal.GetBits(p);
|
|
1643 Byte[] bytes = new Byte[Buffer.ByteLength(bits)];
|
|
1644
|
|
1645 Buffer.BlockCopy(bits, 0, bytes, 0, bytes.Length);
|
|
1646 return bytes;</from>
|
|
1647 <include template="Numeric Types"/>
|
|
1648 <from type="Char" />
|
|
1649 <from type="DateTime" >return ToByteArray(p.ToBinary());</from>
|
|
1650 <from type="DateTimeOffset" >return ToByteArray(p.LocalDateTime.ToBinary());</from>
|
|
1651 <from type="TimeSpan" >return ToByteArray(p.Ticks);</from>
|
|
1652 <from type="Stream" >
|
|
1653 if (p == null) return null;
|
|
1654 if (p is MemoryStream) return ((MemoryStream)p).ToArray();
|
|
1655
|
|
1656 long position = p.Seek(0, SeekOrigin.Begin);
|
|
1657 Byte[] bytes = new Byte[p.Length];
|
|
1658 p.Read(bytes, 0, bytes.Length);
|
|
1659 p.Position = position;
|
|
1660
|
|
1661 return bytes;</from>
|
|
1662 <from type="Char[]" >
|
|
1663 Byte[] bytes = new Byte[Buffer.ByteLength(p)];
|
|
1664
|
|
1665 Buffer.BlockCopy(p, 0, bytes, 0, bytes.Length);
|
|
1666 return bytes;</from>
|
|
1667 <from type="Guid" >return p == Guid.Empty? null: p.ToByteArray();</from>
|
|
1668 <from type="Binary" >return p == null? null: p.ToArray();</from>
|
|
1669 <default >return BitConverter.GetBytes(p);</default>
|
|
1670 </group>
|
|
1671 <group name="Nullable Types." nullable="true">
|
|
1672 <include template="Numeric Types"/>
|
|
1673 <from type="Char" />
|
|
1674 <from type="DateTime" />
|
|
1675 <from type="DateTimeOffset" />
|
|
1676 <from type="TimeSpan" />
|
|
1677 <from type="Guid" />
|
|
1678 <default >return p.HasValue? ToByteArray(p.Value): null;</default>
|
|
1679 </group>
|
|
1680 <group name="SqlTypes">
|
|
1681 <from type="SqlBinary">return p.IsNull? null: p.Value;</from>
|
|
1682 <from type="SqlBytes" >return p.IsNull? null: p.Value;</from>
|
|
1683 <from type="SqlGuid" >return p.IsNull? null: p.ToByteArray();</from>
|
|
1684 <include template="SqlTypes"/>
|
|
1685 <default >return p.IsNull? null: ToByteArray(p.Value);</default>
|
|
1686 </group>
|
|
1687 <default nullvalue="null"/>
|
|
1688 </converter>
|
|
1689
|
|
1690 <converter type="Binary" name="LinqBinary">
|
|
1691 <group name="Scalar Types.">
|
|
1692 <from type="String" >return p == null? null: new Binary(System.Text.Encoding.UTF8.GetBytes(p));</from>
|
|
1693 <from type="Byte" >return new Binary(new byte[]{p});</from>
|
|
1694 <from type="SByte" >return new Binary(new byte[]{checked((Byte)p)});</from>
|
|
1695 <from type="Decimal">
|
|
1696 int[] bits = Decimal.GetBits(p);
|
|
1697 Byte[] bytes = new Byte[Buffer.ByteLength(bits)];
|
|
1698
|
|
1699 Buffer.BlockCopy(bits, 0, bytes, 0, bytes.Length);
|
|
1700 return new Binary(bytes);
|
|
1701 </from>
|
|
1702 <include template="Numeric Types"/>
|
|
1703 <from type="Char" />
|
|
1704 <from type="DateTime" >return new Binary(ToByteArray(p.ToBinary()));</from>
|
|
1705 <from type="DateTimeOffset" >return new Binary(ToByteArray(p.LocalDateTime.ToBinary()));</from>
|
|
1706 <from type="TimeSpan" >return new Binary(ToByteArray(p.Ticks));</from>
|
|
1707 <from type="Stream" >
|
|
1708 if (p == null) return null;
|
|
1709 if (p is MemoryStream) return ((MemoryStream)p).ToArray();
|
|
1710
|
|
1711 long position = p.Seek(0, SeekOrigin.Begin);
|
|
1712 Byte[] bytes = new Byte[p.Length];
|
|
1713 p.Read(bytes, 0, bytes.Length);
|
|
1714 p.Position = position;
|
|
1715
|
|
1716 return new Binary(bytes);
|
|
1717 </from>
|
|
1718 <from type="Char[]" >
|
|
1719 Byte[] bytes = new Byte[Buffer.ByteLength(p)];
|
|
1720
|
|
1721 Buffer.BlockCopy(p, 0, bytes, 0, bytes.Length);
|
|
1722 return new Binary(bytes);
|
|
1723 </from>
|
|
1724 <from type="Guid" >return p == Guid.Empty? null: new Binary(p.ToByteArray());</from>
|
|
1725 <from type="Byte[]" >return p == null? null: new Binary(p);</from>
|
|
1726 <default >return new Binary(BitConverter.GetBytes(p));</default>
|
|
1727 </group>
|
|
1728 <group name="Nullable Types." nullable="true">
|
|
1729 <include template="Numeric Types"/>
|
|
1730 <from type="Char" />
|
|
1731 <from type="DateTime" />
|
|
1732 <from type="DateTimeOffset" />
|
|
1733 <from type="TimeSpan" />
|
|
1734 <from type="Guid" />
|
|
1735 <default >return p.HasValue? new Binary(ToByteArray(p.Value)): null;</default>
|
|
1736 </group>
|
|
1737 <group name="SqlTypes">
|
|
1738 <from type="SqlBinary">return p.IsNull? null: new Binary(p.Value);</from>
|
|
1739 <from type="SqlBytes" >return p.IsNull? null: new Binary(p.Value);</from>
|
|
1740 <from type="SqlGuid" >return p.IsNull? null: new Binary(p.ToByteArray());</from>
|
|
1741 <include template="SqlTypes"/>
|
|
1742 <default >return p.IsNull? null: new Binary(ToByteArray(p.Value));</default>
|
|
1743 </group>
|
|
1744 <default nullvalue="null"/>
|
|
1745 </converter>
|
|
1746
|
|
1747 <converter type="Char[]" name="CharArray">
|
|
1748 <group name="Scalar Types.">
|
|
1749 <from type="String" >return p == null? null: p.ToCharArray();</from>
|
|
1750 </group>
|
|
1751 <group name="SqlTypes">
|
|
1752 <from type="SqlString" >return p.IsNull? null: p.Value.ToCharArray();</from>
|
|
1753 <from type="SqlChars" >return p.IsNull? null: p.Value;</from>
|
|
1754 </group>
|
|
1755 <from type="Byte[]" >
|
|
1756 if (p == null) return null;
|
|
1757
|
|
1758 Char[] chars = new Char[p.Length / sizeof(Char)];
|
|
1759
|
|
1760 Buffer.BlockCopy(p, 0, chars, 0, p.Length);
|
|
1761 return chars;
|
|
1762 </from>
|
|
1763 <from type="Binary" >
|
|
1764 if (p == null) return null;
|
|
1765
|
|
1766 Char[] chars = new Char[p.Length / sizeof(Char)];
|
|
1767
|
|
1768 Buffer.BlockCopy(p.ToArray(), 0, chars, 0, p.Length);
|
|
1769 return chars;
|
|
1770 </from>
|
|
1771 <default nullvalue="null" nothrow="true">
|
|
1772 return ToString(p).ToCharArray();</default>
|
|
1773 </converter>
|
|
1774 <converter type="XmlReader">
|
|
1775 <group name="Scalar Types.">
|
|
1776 <from type="String" >return p == null? null: new XmlTextReader(new StringReader(p));</from>
|
|
1777 </group>
|
|
1778 <group name="SqlTypes">
|
|
1779 <from type="SqlXml" >return p.IsNull? null: p.CreateReader();</from>
|
|
1780 <from type="SqlString">return p.IsNull? null: new XmlTextReader(new StringReader(p.Value));</from>
|
|
1781 <from type="SqlChars" >return p.IsNull? null: new XmlTextReader(new StringReader(p.ToSqlString().Value));</from>
|
|
1782 <from type="SqlBinary">return p.IsNull? null: new XmlTextReader(new MemoryStream(p.Value));</from>
|
|
1783 <default >return p.IsNull? null: new XmlTextReader(p.Value);</default>
|
|
1784 </group>
|
|
1785 <group name="Other Types.">
|
|
1786 <from type="Stream" />
|
|
1787 <from type="TextReader" nick="TR"/>
|
|
1788 <from type="XmlDocument">return p == null? null: new XmlTextReader(new StringReader(p.InnerXml));</from>
|
|
1789 <br/>
|
|
1790 <from type="Char[]" >return p == null? null: new XmlTextReader(new StringReader(new string(p)));</from>
|
|
1791 <from type="Byte[]" >return p == null? null: new XmlTextReader(new MemoryStream(p));</from>
|
|
1792 <from type="Binary" >return p == null? null: new XmlTextReader(new MemoryStream(p.ToArray()));</from>
|
|
1793 <default >return p == null? null: new XmlTextReader(p);</default>
|
|
1794 </group>
|
|
1795 <default nullvalue="null"/>
|
|
1796 </converter>
|
|
1797 <converter type="XmlDocument">
|
|
1798 <group name="Scalar Types.">
|
|
1799 <from type="String" >
|
|
1800 if (string.IsNullOrEmpty(p)) return null;
|
|
1801
|
|
1802 XmlDocument doc = new XmlDocument();
|
|
1803 doc.LoadXml(p);
|
|
1804 return doc;</from>
|
|
1805 </group>
|
|
1806 <group name="SqlTypes">
|
|
1807 <from type="SqlString"/>
|
|
1808 <from type="SqlXml" />
|
|
1809 <from type="SqlChars" >return p.IsNull? null: ToXmlDocument(p.ToSqlString().Value);</from>
|
|
1810 <from type="SqlBinary">return p.IsNull? null: ToXmlDocument(new MemoryStream(p.Value));</from>
|
|
1811 <default >return p.IsNull? null: ToXmlDocument(p.Value);</default>
|
|
1812 </group>
|
|
1813 <group name="Other Types.">
|
|
1814 <from type="Stream" />
|
|
1815 <from type="TextReader" nick="TR"/>
|
|
1816 <from type="XmlReader"/>
|
|
1817 <br/>
|
|
1818 <from type="Char[]" >return p == null || p.Length == 0? null: ToXmlDocument(new string(p));</from>
|
|
1819 <from type="Byte[]" >return p == null || p.Length == 0? null: ToXmlDocument(new MemoryStream(p));</from>
|
|
1820 <from type="Binary" >return p == null || p.Length == 0? null: ToXmlDocument(new MemoryStream(p.ToArray()));</from>
|
|
1821 <default >
|
|
1822 if (p == null) return null;
|
|
1823
|
|
1824 XmlDocument doc = new XmlDocument();
|
|
1825 doc.Load(p);
|
|
1826 return doc;
|
|
1827 </default>
|
|
1828 </group>
|
|
1829 <default nullvalue="null"/>
|
|
1830 </converter>
|
|
1831 </region>
|
|
1832 </code>
|