Mercurial > pub > bltoolkit
comparison Source/Mapping/ObjectMapperT.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 BLToolkit.Reflection; | |
2 | |
3 namespace BLToolkit.Mapping | |
4 { | |
5 public static class ObjectMapper<T> | |
6 { | |
7 public static T CreateInstance() | |
8 { | |
9 return (T)_instance.CreateInstance(); | |
10 } | |
11 | |
12 public static T CreateInstance(InitContext context) | |
13 { | |
14 return (T)_instance.CreateInstance(context); | |
15 } | |
16 | |
17 public static int Count | |
18 { | |
19 get { return _instance.Count; } | |
20 } | |
21 | |
22 public static string GetName(int index) | |
23 { | |
24 return _instance.GetName(index); | |
25 } | |
26 | |
27 public static object GetValue(T o, int index) | |
28 { | |
29 return _instance.GetValue(o, index); | |
30 } | |
31 | |
32 public static object GetValue(T o, string name) | |
33 { | |
34 return _instance.GetValue(o, name); | |
35 } | |
36 | |
37 public static int GetOrdinal(string name) | |
38 { | |
39 return _instance.GetOrdinal(name); | |
40 } | |
41 | |
42 public static void SetValue(T o, int index, object value) | |
43 { | |
44 _instance.SetValue(o, index, value); | |
45 } | |
46 | |
47 public static void SetValue(object o, string name, object value) | |
48 { | |
49 _instance.SetValue(o, name, value); | |
50 } | |
51 | |
52 private static readonly ObjectMapper _instance = Map.GetObjectMapper(typeof(T)); | |
53 public static ObjectMapper Instance | |
54 { | |
55 get { return _instance; } | |
56 } | |
57 } | |
58 } |