comparison Source/Mapping/Map.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.Data;
5
6 namespace BLToolkit.Mapping
7 {
8 using Common;
9 using Reflection;
10 using Reflection.Extension;
11
12 public class Map
13 {
14 #region Public Members
15
16 private static MappingSchema _defaultSchema = new DefaultMappingSchema();
17 public static MappingSchema DefaultSchema
18 {
19 [System.Diagnostics.DebuggerStepThrough]
20 get { return _defaultSchema; }
21 set { _defaultSchema = value; }
22 }
23
24 public static ExtensionList Extensions
25 {
26 [System.Diagnostics.DebuggerStepThrough]
27 get { return _defaultSchema.Extensions; }
28 set { _defaultSchema.Extensions = value; }
29 }
30
31 public static ObjectMapper GetObjectMapper(Type type)
32 {
33 return _defaultSchema.GetObjectMapper(type);
34 }
35
36 #endregion
37
38 #region GetNullValue
39
40 public static object GetNullValue(Type type)
41 {
42 return _defaultSchema.GetNullValue(type);
43 }
44
45 public static bool IsNull(object value)
46 {
47 return _defaultSchema.IsNull(value);
48 }
49
50 #endregion
51
52 #region Base Mapping
53
54 public static void SourceToDestination(object sourceObject, object destObject, params object[] parameters)
55 {
56 _defaultSchema.MapSourceToDestination(sourceObject, destObject, parameters);
57 }
58
59 [CLSCompliant(false)]
60 public static void MapSourceToDestination(
61 IMapDataSource source, object sourceObject,
62 IMapDataDestination dest, object destObject,
63 params object[] parameters)
64 {
65 _defaultSchema.MapSourceToDestination(source, sourceObject, dest, destObject, parameters);
66 }
67
68 [CLSCompliant(false)]
69 public static void SourceListToDestinationList(
70 IMapDataSourceList dataSourceList,
71 IMapDataDestinationList dataDestinationList,
72 params object[] parameters)
73 {
74 _defaultSchema.MapSourceListToDestinationList(dataSourceList, dataDestinationList, parameters);
75 }
76
77 #endregion
78
79 #region ValueToEnum, EnumToValue
80
81 public static object ValueToEnum(object value, Type type)
82 {
83 return _defaultSchema.MapValueToEnum(value, type);
84 }
85
86 public static object EnumToValue(object value)
87 {
88 return _defaultSchema.MapEnumToValue(value);
89 }
90
91 public static object EnumToValue(object value, bool convertToUnderlyingType)
92 {
93 return _defaultSchema.MapEnumToValue(value, convertToUnderlyingType);
94 }
95
96 public static T ToEnum<T>(object value)
97 {
98 return (T)_defaultSchema.MapValueToEnum(value, typeof(T));
99 }
100
101 #endregion
102
103 #region Object
104
105 #region ObjectToObject
106
107 public static object ObjectToObject(object sourceObject, object destObject, params object[] parameters)
108 {
109 return _defaultSchema.MapObjectToObject(sourceObject, destObject, parameters);
110 }
111
112 public static object ObjectToObject(object sourceObject, Type destObjectType, params object[] parameters)
113 {
114 return _defaultSchema.MapObjectToObject(sourceObject, destObjectType, parameters);
115 }
116
117 public static T ObjectToObject<T>(object sourceObject, params object[] parameters)
118 {
119 return (T)_defaultSchema.MapObjectToObject(sourceObject, typeof(T), parameters);
120 }
121
122 #endregion
123
124 #region ObjectToDataRow
125
126 #if !SILVERLIGHT
127
128 public static DataRow ObjectToDataRow(object sourceObject, DataRow destRow)
129 {
130 return _defaultSchema.MapObjectToDataRow(sourceObject, destRow);
131 }
132
133 public static DataRow ObjectToDataRow(object sourceObject, DataTable destTable)
134 {
135 return _defaultSchema.MapObjectToDataRow(sourceObject, destTable);
136 }
137
138 #endif
139
140 #endregion
141
142 #region ObjectToDictionary
143
144 public static IDictionary ObjectToDictionary(object sourceObject, IDictionary destDictionary)
145 {
146 return _defaultSchema.MapObjectToDictionary(sourceObject, destDictionary);
147 }
148
149 public static IDictionary ObjectToDictionary(object sourceObject)
150 {
151 return _defaultSchema.MapObjectToDictionary(sourceObject);
152 }
153
154 #endregion
155
156 #endregion
157
158 #region DataRow
159
160 #region DataRowToObject
161
162 #if !SILVERLIGHT
163
164 public static object DataRowToObject(DataRow dataRow, object destObject, params object[] parameters)
165 {
166 return _defaultSchema.MapDataRowToObject(dataRow, destObject, parameters);
167 }
168
169 public static object DataRowToObject(
170 DataRow dataRow, DataRowVersion version, object destObject, params object[] parameters)
171 {
172 return _defaultSchema.MapDataRowToObject(dataRow, version, destObject, parameters);
173 }
174
175 public static object DataRowToObject(DataRow dataRow, Type destObjectType, params object[] parameters)
176 {
177 return _defaultSchema.MapDataRowToObject(dataRow, destObjectType, parameters);
178 }
179
180 public static object DataRowToObject(
181 DataRow dataRow, DataRowVersion version, Type destObjectType, params object[] parameters)
182 {
183 return _defaultSchema.MapDataRowToObject(dataRow, version, destObjectType, parameters);
184 }
185
186 public static T DataRowToObject<T>(DataRow dataRow, params object[] parameters)
187 {
188 return (T)_defaultSchema.MapDataRowToObject(dataRow, typeof(T), parameters);
189 }
190
191 public static T DataRowToObject<T>(DataRow dataRow, DataRowVersion version, params object[] parameters)
192 {
193 return (T)_defaultSchema.MapDataRowToObject(dataRow, version, typeof(T), parameters);
194 }
195
196 #endif
197
198 #endregion
199
200 #region DataRowToDataRow
201
202 #if !SILVERLIGHT
203
204 public static DataRow DataRowToDataRow(DataRow sourceRow, DataRow destRow)
205 {
206 return _defaultSchema.MapDataRowToDataRow(sourceRow, destRow);
207 }
208
209 public static DataRow DataRowToDataRow(DataRow sourceRow, DataRowVersion version, DataRow destRow)
210 {
211 return _defaultSchema.MapDataRowToDataRow(sourceRow, version, destRow);
212 }
213
214 public static DataRow DataRowToDataRow(DataRow sourceRow, DataTable destTable)
215 {
216 return _defaultSchema.MapDataRowToDataRow(sourceRow, destTable);
217 }
218
219 public static DataRow DataRowToDataRow(DataRow sourceRow, DataRowVersion version, DataTable destTable)
220 {
221 return _defaultSchema.MapDataRowToDataRow(sourceRow, version, destTable);
222 }
223
224 #endif
225
226 #endregion
227
228 #region DataRowToDictionary
229
230 #if !SILVERLIGHT
231
232 public static IDictionary DataRowToDictionary(DataRow sourceRow, IDictionary destDictionary)
233 {
234 return _defaultSchema.MapDataRowToDictionary(sourceRow, destDictionary);
235 }
236
237 public static Hashtable DataRowToDictionary(DataRow sourceRow)
238 {
239 return _defaultSchema.MapDataRowToDictionary(sourceRow);
240 }
241
242 public static IDictionary DataRowToDictionary(
243 DataRow sourceRow, DataRowVersion version, IDictionary destDictionary)
244 {
245 return _defaultSchema.MapDataRowToDictionary(sourceRow, version, destDictionary);
246 }
247
248 public static Hashtable DataRowToDictionary(DataRow sourceRow, DataRowVersion version)
249 {
250 return _defaultSchema.MapDataRowToDictionary(sourceRow, version);
251 }
252
253 #endif
254
255 #endregion
256
257 #endregion
258
259 #region DataReader
260
261 #region DataReaderToObject
262
263 public static object DataReaderToObject(IDataReader dataReader, object destObject, params object[] parameters)
264 {
265 return _defaultSchema.MapDataReaderToObject(dataReader, destObject, parameters);
266 }
267
268 public static object DataReaderToObject(IDataReader dataReader, Type destObjectType, params object[] parameters)
269 {
270 return _defaultSchema.MapDataReaderToObject(dataReader, destObjectType, parameters);
271 }
272
273 public static T DataReaderToObject<T>(IDataReader dataReader, params object[] parameters)
274 {
275 return (T)_defaultSchema.MapDataReaderToObject(dataReader, typeof(T), parameters);
276 }
277
278 #endregion
279
280 #region DataReaderToDataRow
281
282 #if !SILVERLIGHT
283
284 public static DataRow DataReaderToDataRow(IDataReader dataReader, DataRow destRow)
285 {
286 return _defaultSchema.MapDataReaderToDataRow(dataReader, destRow);
287 }
288
289 public static DataRow DataReaderToDataRow(IDataReader dataReader, DataTable destTable)
290 {
291 return _defaultSchema.MapDataReaderToDataRow(dataReader, destTable);
292 }
293
294 #endif
295
296 #endregion
297
298 #region DataReaderToDictionary
299
300 public static IDictionary DataReaderToDictionary(IDataReader dataReader, IDictionary destDictionary)
301 {
302 return _defaultSchema.MapDataReaderToDictionary(dataReader, destDictionary);
303 }
304
305 public static IDictionary DataReaderToDictionary(IDataReader dataReader)
306 {
307 return _defaultSchema.MapDataReaderToDictionary(dataReader);
308 }
309
310 #endregion
311
312 #endregion
313
314 #region Dictionary
315
316 #region DictionaryToObject
317
318 public static object DictionaryToObject(
319 IDictionary sourceDictionary, object destObject, params object[] parameters)
320 {
321 return _defaultSchema.MapDictionaryToObject(sourceDictionary, destObject, parameters);
322 }
323
324 public static object DictionaryToObject(
325 IDictionary sourceDictionary, Type destObjectType, params object[] parameters)
326 {
327 return _defaultSchema.MapDictionaryToObject(sourceDictionary, destObjectType, parameters);
328 }
329
330 public static T DictionaryToObject<T>(IDictionary sourceDictionary, params object[] parameters)
331 {
332 return (T)_defaultSchema.MapDictionaryToObject(sourceDictionary, typeof(T), parameters);
333 }
334
335 #endregion
336
337 #region DictionaryToDataRow
338
339 #if !SILVERLIGHT
340
341 public static DataRow DictionaryToDataRow(IDictionary sourceDictionary, DataRow destRow)
342 {
343 return _defaultSchema.MapDictionaryToDataRow(sourceDictionary, destRow);
344 }
345
346 public static DataRow DictionaryToDataRow(IDictionary sourceDictionary, DataTable destTable)
347 {
348 return _defaultSchema.MapDictionaryToDataRow(sourceDictionary, destTable);
349 }
350
351 #endif
352
353 #endregion
354
355 #endregion
356
357 #region List
358
359 #region ListToList
360
361 public static IList ListToList(
362 ICollection sourceList,
363 IList destList,
364 Type destObjectType,
365 params object[] parameters)
366 {
367 return _defaultSchema.MapListToList(sourceList, destList, destObjectType, parameters);
368 }
369
370 public static IList ListToList(ICollection sourceList, Type destObjectType, params object[] parameters)
371 {
372 return _defaultSchema.MapListToList(sourceList, destObjectType, parameters);
373 }
374
375 public static List<T> ListToList<T>(ICollection sourceList, List<T> destList, params object[] parameters)
376 {
377 return _defaultSchema.MapListToList(sourceList, destList, parameters);
378 }
379
380 public static List<T> ListToList<T>(ICollection sourceList, params object[] parameters)
381 {
382 return _defaultSchema.MapListToList<T>(sourceList, parameters);
383 }
384
385 #endregion
386
387 #region ListToDataTable
388
389 #if !SILVERLIGHT
390
391 public static DataTable ListToDataTable(ICollection sourceList, DataTable destTable)
392 {
393 return _defaultSchema.MapListToDataTable(sourceList, destTable);
394 }
395
396 public static DataTable ListToDataTable(ICollection sourceList)
397 {
398 return _defaultSchema.MapListToDataTable(sourceList);
399 }
400
401 #endif
402
403 #endregion
404
405 #region MapListToDictionary
406
407 public static IDictionary ListToDictionary(
408 ICollection sourceList,
409 IDictionary destDictionary,
410 NameOrIndexParameter keyField,
411 Type destObjectType,
412 params object[] parameters)
413 {
414 return _defaultSchema.MapListToDictionary(
415 sourceList, destDictionary, keyField, destObjectType, parameters);
416 }
417
418 public static IDictionary ListToDictionary(
419 ICollection sourceList,
420 NameOrIndexParameter keyField,
421 Type destObjectType,
422 params object[] parameters)
423 {
424 return _defaultSchema.MapListToDictionary(sourceList, keyField, destObjectType, parameters);
425 }
426
427 public static IDictionary<TK,T> ListToDictionary<TK,T>(
428 ICollection sourceList,
429 IDictionary<TK,T> destDictionary,
430 NameOrIndexParameter keyField,
431 params object[] parameters)
432 {
433 return _defaultSchema.MapListToDictionary(sourceList, destDictionary, keyField, parameters);
434 }
435
436 public static Dictionary<TK,T> ListToDictionary<TK,T>(
437 ICollection sourceList,
438 NameOrIndexParameter keyField,
439 params object[] parameters)
440 {
441 return _defaultSchema.MapListToDictionary<TK,T>(sourceList, keyField, parameters);
442 }
443
444 #endregion
445
446 #region MapListToDictionary (Index)
447
448 public static IDictionary ListToDictionary(
449 ICollection sourceList,
450 IDictionary destDictionary,
451 MapIndex index,
452 Type destObjectType,
453 params object[] parameters)
454 {
455 return _defaultSchema.MapListToDictionary(
456 sourceList, destDictionary, index, destObjectType, parameters);
457 }
458
459 public static IDictionary ListToDictionary(
460 ICollection sourceList,
461 MapIndex index,
462 Type destObjectType,
463 params object[] parameters)
464 {
465 return _defaultSchema.MapListToDictionary(sourceList, index, destObjectType, parameters);
466 }
467
468 public static IDictionary<CompoundValue,T> ListToDictionary<T>(
469 ICollection sourceList,
470 IDictionary<CompoundValue,T> destDictionary,
471 MapIndex index,
472 params object[] parameters)
473 {
474 return _defaultSchema.MapListToDictionary(sourceList, destDictionary, index, parameters);
475 }
476
477 public static Dictionary<CompoundValue,T> ListToDictionary<T>(
478 ICollection sourceList,
479 MapIndex index,
480 params object[] parameters)
481 {
482 return _defaultSchema.MapListToDictionary<T>(sourceList, index, parameters);
483 }
484
485 #endregion
486
487 #endregion
488
489 #region DataTable
490
491 #region DataTableToDataTable
492
493 #if !SILVERLIGHT
494
495 public static DataTable DataTableToDataTable(DataTable sourceTable, DataTable destTable)
496 {
497 return _defaultSchema.MapDataTableToDataTable(sourceTable, destTable);
498 }
499
500 public static DataTable DataTableToDataTable(DataTable sourceTable, DataRowVersion version, DataTable destTable)
501 {
502 return _defaultSchema.MapDataTableToDataTable(sourceTable, version, destTable);
503 }
504
505 public static DataTable DataTableToDataTable(DataTable sourceTable)
506 {
507 return _defaultSchema.MapDataTableToDataTable(sourceTable);
508 }
509
510 public static DataTable DataTableToDataTable(DataTable sourceTable, DataRowVersion version)
511 {
512 return _defaultSchema.MapDataTableToDataTable(sourceTable, version);
513 }
514
515 #endif
516
517 #endregion
518
519 #region DataTableToList
520
521 #if !SILVERLIGHT
522
523 public static IList DataTableToList(
524 DataTable sourceTable, IList list, Type destObjectType, params object[] parameters)
525 {
526 return _defaultSchema.MapDataTableToList(sourceTable, list, destObjectType, parameters);
527 }
528
529 public static IList DataTableToList(
530 DataTable sourceTable,
531 DataRowVersion version,
532 IList list,
533 Type destObjectType,
534 params object[] parameters)
535 {
536 return _defaultSchema.MapDataTableToList(sourceTable, version, list, destObjectType, parameters);
537 }
538
539 public static ArrayList DataTableToList(DataTable sourceTable, Type destObjectType, params object[] parameters)
540 {
541 return _defaultSchema.MapDataTableToList(sourceTable, destObjectType, parameters);
542 }
543
544 public static ArrayList DataTableToList(
545 DataTable sourceTable, DataRowVersion version, Type destObjectType, params object[] parameters)
546 {
547 return _defaultSchema.MapDataTableToList(sourceTable, version, destObjectType, parameters);
548 }
549
550 public static List<T> DataTableToList<T>(DataTable sourceTable, List<T> list, params object[] parameters)
551 {
552 return _defaultSchema.MapDataTableToList(sourceTable, list, parameters);
553 }
554
555 public static List<T> DataTableToList<T>(
556 DataTable sourceTable,
557 DataRowVersion version,
558 List<T> list,
559 params object[] parameters)
560 {
561 return _defaultSchema.MapDataTableToList(sourceTable, version, list, parameters);
562 }
563
564 public static List<T> DataTableToList<T>(DataTable sourceTable, params object[] parameters)
565 {
566 return _defaultSchema.MapDataTableToList<T>(sourceTable, parameters);
567 }
568
569 public static List<T> DataTableToList<T>(DataTable sourceTable, DataRowVersion version, params object[] parameters)
570 {
571 return _defaultSchema.MapDataTableToList<T>(sourceTable, version, parameters);
572 }
573
574 #endif
575
576 #endregion
577
578 #region DataTableToDictionary
579
580 #if !SILVERLIGHT
581
582 public static IDictionary DataTableToDictionary(
583 DataTable sourceTable,
584 IDictionary destDictionary,
585 NameOrIndexParameter keyField,
586 Type destObjectType,
587 params object[] parameters)
588 {
589 return _defaultSchema.MapDataTableToDictionary(
590 sourceTable, destDictionary, keyField, destObjectType, parameters);
591 }
592
593 public static Hashtable DataTableToDictionary(
594 DataTable sourceTable,
595 NameOrIndexParameter keyField,
596 Type destObjectType,
597 params object[] parameters)
598 {
599 return _defaultSchema.MapDataTableToDictionary(sourceTable, keyField, destObjectType, parameters);
600 }
601
602 public static IDictionary<TK,T> DataTableToDictionary<TK,T>(
603 DataTable sourceTable,
604 IDictionary<TK,T> destDictionary,
605 NameOrIndexParameter keyField,
606 params object[] parameters)
607 {
608 return _defaultSchema.MapDataTableToDictionary(sourceTable, destDictionary, keyField, parameters);
609 }
610
611 public static Dictionary<TK,T> DataTableToDictionary<TK,T>(
612 DataTable sourceTable,
613 NameOrIndexParameter keyField,
614 params object[] parameters)
615 {
616 return _defaultSchema.MapDataTableToDictionary<TK,T>(sourceTable, keyField, parameters);
617 }
618
619 #endif
620
621 #endregion
622
623 #region DataTableToDictionary (Index)
624
625 #if !SILVERLIGHT
626
627 public static IDictionary DataTableToDictionary(
628 DataTable sourceTable,
629 IDictionary destDictionary,
630 MapIndex index,
631 Type destObjectType,
632 params object[] parameters)
633 {
634 return _defaultSchema.MapDataTableToDictionary(
635 sourceTable, destDictionary, index, destObjectType, parameters);
636 }
637
638 public static Hashtable DataTableToDictionary(
639 DataTable sourceTable,
640 MapIndex index,
641 Type destObjectType,
642 params object[] parameters)
643 {
644 return _defaultSchema.MapDataTableToDictionary(sourceTable, index, destObjectType, parameters);
645 }
646
647 public static IDictionary<CompoundValue,T> DataTableToDictionary<T>(
648 DataTable sourceTable,
649 IDictionary<CompoundValue,T> destDictionary,
650 MapIndex index,
651 params object[] parameters)
652 {
653 return _defaultSchema.MapDataTableToDictionary(sourceTable, destDictionary, index, parameters);
654 }
655
656 public static Dictionary<CompoundValue,T> DataTableToDictionary<T>(
657 DataTable sourceTable,
658 MapIndex index,
659 params object[] parameters)
660 {
661 return _defaultSchema.MapDataTableToDictionary<T>(sourceTable, index, parameters);
662 }
663
664 #endif
665
666 #endregion
667
668 #endregion
669
670 #region DataReader
671
672 #region DataReaderToList
673
674 public static IList DataReaderToList(
675 IDataReader reader,
676 IList list,
677 Type destObjectType,
678 params object[] parameters)
679 {
680 return _defaultSchema.MapDataReaderToList(reader, list, destObjectType, parameters);
681 }
682
683 public static IList DataReaderToList(IDataReader reader, Type destObjectType, params object[] parameters)
684 {
685 return _defaultSchema.MapDataReaderToList(reader, destObjectType, parameters);
686 }
687
688 public static IList<T> DataReaderToList<T>(IDataReader reader, IList<T> list, params object[] parameters)
689 {
690 return _defaultSchema.MapDataReaderToList(reader, list, parameters);
691 }
692
693 public static List<T> DataReaderToList<T>(IDataReader reader, params object[] parameters)
694 {
695 return _defaultSchema.MapDataReaderToList<T>(reader, parameters);
696 }
697
698 #endregion
699
700 #region DataReaderToDataTable
701
702 #if !SILVERLIGHT
703
704 public static DataTable DataReaderToDataTable(IDataReader reader, DataTable destTable)
705 {
706 return _defaultSchema.MapDataReaderToDataTable(reader, destTable);
707 }
708
709 public static DataTable DataReaderToDataTable(IDataReader reader)
710 {
711 return _defaultSchema.MapDataReaderToDataTable(reader);
712 }
713
714 #endif
715
716 #endregion
717
718 #region DataReaderToDictionary
719
720 public static IDictionary DataReaderToDictionary(
721 IDataReader dataReader,
722 IDictionary destDictionary,
723 NameOrIndexParameter keyField,
724 Type destObjectType,
725 params object[] parameters)
726 {
727 return _defaultSchema.MapDataReaderToDictionary(
728 dataReader, destDictionary, keyField, destObjectType, parameters);
729 }
730
731 public static IDictionary DataReaderToDictionary(
732 IDataReader dataReader,
733 NameOrIndexParameter keyField,
734 Type destObjectType,
735 params object[] parameters)
736 {
737 return _defaultSchema.MapDataReaderToDictionary(dataReader, keyField, destObjectType, parameters);
738 }
739
740 public static IDictionary<TK,T> DataReaderToDictionary<TK,T>(
741 IDataReader dataReader,
742 IDictionary<TK,T> destDictionary,
743 NameOrIndexParameter keyField,
744 params object[] parameters)
745 {
746 return _defaultSchema.MapDataReaderToDictionary(
747 dataReader, destDictionary, keyField, parameters);
748 }
749
750 public static Dictionary<TK,T> DataReaderToDictionary<TK,T>(
751 IDataReader dataReader,
752 NameOrIndexParameter keyField,
753 params object[] parameters)
754 {
755 return _defaultSchema.MapDataReaderToDictionary<TK,T>(dataReader, keyField, parameters);
756 }
757
758 #endregion
759
760 #region DataReaderToDictionary (Index)
761
762 public static IDictionary DataReaderToDictionary(
763 IDataReader dataReader,
764 IDictionary destDictionary,
765 MapIndex index,
766 Type destObjectType,
767 params object[] parameters)
768 {
769 return _defaultSchema.MapDataReaderToDictionary(
770 dataReader, destDictionary, index, destObjectType, parameters);
771 }
772
773 public static IDictionary DataReaderToDictionary(
774 IDataReader dataReader,
775 MapIndex index,
776 Type destObjectType,
777 params object[] parameters)
778 {
779 return _defaultSchema.MapDataReaderToDictionary(dataReader, index, destObjectType, parameters);
780 }
781
782 public static IDictionary<CompoundValue,T> DataReaderToDictionary<T>(
783 IDataReader dataReader,
784 IDictionary<CompoundValue,T> destDictionary,
785 MapIndex index,
786 params object[] parameters)
787 {
788 return _defaultSchema.MapDataReaderToDictionary(dataReader, destDictionary, index, parameters);
789 }
790
791 public static Dictionary<CompoundValue,T> DataReaderToDictionary<T>(
792 IDataReader dataReader,
793 MapIndex index,
794 params object[] parameters)
795 {
796 return _defaultSchema.MapDataReaderToDictionary<T>(dataReader, index, parameters);
797 }
798
799 #endregion
800
801 #endregion
802
803 #region Dictionary
804
805 #region DictionaryToList
806
807 public static IList DictionaryToList(
808 IDictionary sourceDictionary,
809 IList destList,
810 Type destObjectType,
811 params object[] parameters)
812 {
813 return _defaultSchema.MapDictionaryToList(sourceDictionary, destList, destObjectType, parameters);
814 }
815
816 public static IList DictionaryToList(
817 IDictionary sourceDictionary,
818 Type destObjectType,
819 params object[] parameters)
820 {
821 return _defaultSchema.MapDictionaryToList(sourceDictionary, destObjectType, parameters);
822 }
823
824 public static List<T> DictionaryToList<T>(
825 IDictionary sourceDictionary,
826 List<T> destList,
827 params object[] parameters)
828 {
829 return _defaultSchema.MapDictionaryToList(sourceDictionary, destList, parameters);
830 }
831
832 public static List<T> DictionaryToList<T>(IDictionary sourceDictionary, params object[] parameters)
833 {
834 return _defaultSchema.MapDictionaryToList<T>(sourceDictionary, parameters);
835 }
836
837 #endregion
838
839 #region DictionaryToDataTable
840
841 #if !SILVERLIGHT
842
843 public static DataTable DictionaryToDataTable(IDictionary sourceDictionary, DataTable destTable)
844 {
845 return _defaultSchema.MapDictionaryToDataTable(sourceDictionary, destTable);
846 }
847
848 public static DataTable DictionaryToDataTable(IDictionary sourceDictionary)
849 {
850 return _defaultSchema.MapDictionaryToDataTable(sourceDictionary);
851 }
852
853 #endif
854
855 #endregion
856
857 #region DictionaryToDictionary
858
859 public static IDictionary DictionaryToDictionary(
860 IDictionary sourceDictionary,
861 IDictionary destDictionary,
862 NameOrIndexParameter keyField,
863 Type destObjectType,
864 params object[] parameters)
865 {
866 return _defaultSchema.MapDictionaryToDictionary(
867 sourceDictionary, destDictionary, keyField, destObjectType, parameters);
868 }
869
870 public static IDictionary DictionaryToDictionary(
871 IDictionary sourceDictionary,
872 NameOrIndexParameter keyField,
873 Type destObjectType,
874 params object[] parameters)
875 {
876 return _defaultSchema.MapDictionaryToDictionary(
877 sourceDictionary, keyField, destObjectType, parameters);
878 }
879
880 public static IDictionary<TK,T> DictionaryToDictionary<TK,T>(
881 IDictionary sourceDictionary,
882 IDictionary<TK,T> destDictionary,
883 NameOrIndexParameter keyField,
884 params object[] parameters)
885 {
886 return _defaultSchema.MapDictionaryToDictionary(sourceDictionary, destDictionary, keyField, parameters);
887 }
888
889 public static Dictionary<TK,T> DictionaryToDictionary<TK,T>(
890 IDictionary sourceDictionary,
891 NameOrIndexParameter keyField,
892 params object[] parameters)
893 {
894 return _defaultSchema.MapDictionaryToDictionary<TK,T>(sourceDictionary, keyField, parameters);
895 }
896
897 #endregion
898
899 #region DictionaryToDictionary (Index)
900
901 public static IDictionary DictionaryToDictionary(
902 IDictionary sourceDictionary,
903 IDictionary destDictionary,
904 MapIndex index,
905 Type destObjectType,
906 params object[] parameters)
907 {
908 return _defaultSchema.MapDictionaryToDictionary(
909 sourceDictionary, destDictionary, index, destObjectType, parameters);
910 }
911
912 public static IDictionary DictionaryToDictionary(
913 IDictionary sourceDictionary,
914 MapIndex index,
915 Type destObjectType,
916 params object[] parameters)
917 {
918 return _defaultSchema.MapDictionaryToDictionary(sourceDictionary, index, destObjectType, parameters);
919 }
920
921 public static IDictionary<CompoundValue,T> DictionaryToDictionary<T>(
922 IDictionary sourceDictionary,
923 IDictionary<CompoundValue,T> destDictionary,
924 MapIndex index,
925 params object[] parameters)
926 {
927 return _defaultSchema.MapDictionaryToDictionary(sourceDictionary, destDictionary, index, parameters);
928 }
929
930 public static Dictionary<CompoundValue,T> DictionaryToDictionary<T>(
931 IDictionary sourceDictionary,
932 MapIndex index,
933 params object[] parameters)
934 {
935 return _defaultSchema.MapDictionaryToDictionary<T>(sourceDictionary, index, parameters);
936 }
937
938 #endregion
939
940 #endregion
941
942 #region ToResultSet
943
944 public static void ResultSets(MapResultSet[] resultSets)
945 {
946 _defaultSchema.MapResultSets(resultSets);//, true);
947 }
948
949 //public static void ResultSets(MapResultSet[] resultSets, bool throwException)
950 //{
951 // _defaultSchema.MapResultSets(resultSets, throwException);
952 //}
953
954 //public static void DataReaderToResultSet(IDataReader reader, MapResultSet[] resultSets)
955 //{
956 // _defaultSchema.MapDataReaderToResultSet(reader, resultSets, true);
957 //}
958
959 //public static void DataReaderToResultSet(
960 // IDataReader reader, MapResultSet[] resultSets, bool throwException)
961 //{
962 // _defaultSchema.MapDataReaderToResultSet(reader, resultSets, throwException);
963 //}
964
965 //public static void DataSetToResultSet(DataSet dataSet, MapResultSet[] resultSets)
966 //{
967 // _defaultSchema.MapDataSetToResultSet(dataSet, resultSets, true);
968 //}
969
970 //public static void DataSetToResultSet(
971 // DataSet dataSet, MapResultSet[] resultSets, bool throwException)
972 //{
973 // _defaultSchema.MapDataSetToResultSet(dataSet, resultSets, throwException);
974 //}
975
976 //public static MapResultSet[] Clone(MapResultSet[] resultSets)
977 //{
978 // return _defaultSchema.Clone(resultSets);
979 //}
980
981 //public static MapResultSet[] ConvertToResultSet(Type masterType, params MapNextResult[] nextResults)
982 //{
983 // return _defaultSchema.ConvertToResultSet(masterType, nextResults);
984 //}
985
986 #endregion
987
988 #region CreateInstance
989
990 public static object CreateInstance(Type type)
991 {
992 return TypeAccessor.CreateInstanceEx(type);
993 }
994
995 public static T CreateInstance<T>()
996 {
997 return TypeAccessor<T>.CreateInstanceEx();
998 }
999
1000 #endregion
1001
1002 #region GetObjectMapper
1003
1004 public static Func<TSource,TDest> GetObjectMapper<TSource,TDest>()
1005 {
1006 return _defaultSchema.GetObjectMapper<TSource,TDest>();
1007 }
1008
1009 public static Func<TSource,TDest> GetObjectMapper<TSource,TDest>(bool deepCopy)
1010 {
1011 return _defaultSchema.GetObjectMapper<TSource,TDest>(deepCopy);
1012 }
1013
1014 public static Func<TSource,TDest> GetObjectMapper<TSource,TDest>(bool deepCopy, bool includeComplexMapping)
1015 {
1016 return _defaultSchema.GetObjectMapper<TSource,TDest>(deepCopy, includeComplexMapping);
1017 }
1018
1019 #endregion
1020 }
1021 }