0
|
1 using System;
|
|
2 using System.Diagnostics.CodeAnalysis;
|
|
3
|
|
4 namespace BLToolkit.Mapping
|
|
5 {
|
|
6 [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
|
|
7 [AttributeUsage(
|
|
8 AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Enum |
|
|
9 AttributeTargets.Class | AttributeTargets.Interface,
|
|
10 AllowMultiple=true)]
|
|
11 public class MapValueAttribute : Attribute
|
|
12 {
|
|
13 public MapValueAttribute(object value1)
|
|
14 {
|
|
15 SetValues(null, null, value1);
|
|
16 }
|
|
17
|
|
18 public MapValueAttribute(object[] values)
|
|
19 {
|
|
20 SetValues(null, null, values);
|
|
21 }
|
|
22
|
|
23 public MapValueAttribute(object origValue, object[] values)
|
|
24 {
|
|
25 SetValues(null, origValue, values);
|
|
26 }
|
|
27
|
|
28 public MapValueAttribute(object origValue, object value1)
|
|
29 {
|
|
30 SetValues(null, origValue, value1);
|
|
31 }
|
|
32
|
|
33 public MapValueAttribute(object origValue, object value1, object value2)
|
|
34 {
|
|
35 SetValues(null, origValue, value1, value2);
|
|
36 }
|
|
37
|
|
38 public MapValueAttribute(object origValue, object value1, object value2, object value3)
|
|
39 {
|
|
40 SetValues(null, origValue, value1, value2, value3);
|
|
41 }
|
|
42
|
|
43 public MapValueAttribute(object origValue, object value1, object value2, object value3, object value4)
|
|
44 {
|
|
45 SetValues(null, origValue, value1, value2, value3, value4);
|
|
46 }
|
|
47
|
|
48 public MapValueAttribute(object origValue, object value1, object value2, object value3, object value4, object value5)
|
|
49 {
|
|
50 SetValues(null, origValue, value1, value2, value3, value4, value5);
|
|
51 }
|
|
52
|
|
53 public MapValueAttribute(Type type, object origValue, object[] values)
|
|
54 {
|
|
55 SetValues(type, origValue, values);
|
|
56 }
|
|
57
|
|
58 public MapValueAttribute(Type type, object origValue, object value1)
|
|
59 {
|
|
60 SetValues(type, origValue, value1);
|
|
61 }
|
|
62
|
|
63 public MapValueAttribute(Type type, object origValue, object value1, object value2)
|
|
64 {
|
|
65 SetValues(type, origValue, value1, value2);
|
|
66 }
|
|
67
|
|
68 public MapValueAttribute(Type type, object origValue, object value1, object value2, object value3)
|
|
69 {
|
|
70 SetValues(type, origValue, value1, value2, value3);
|
|
71 }
|
|
72
|
|
73 public MapValueAttribute(Type type, object origValue, object value1, object value2, object value3, object value4)
|
|
74 {
|
|
75 SetValues(type, origValue, value1, value2, value3, value4);
|
|
76 }
|
|
77
|
|
78 public MapValueAttribute(Type type, object origValue, object value1, object value2, object value3, object value4, object value5)
|
|
79 {
|
|
80 SetValues(type, origValue, value1, value2, value3, value4, value5);
|
|
81 }
|
|
82
|
|
83 protected void SetValues(Type type, object origValue, params object[] values)
|
|
84 {
|
|
85 _type = type;
|
|
86 _origValue = origValue;
|
|
87 _values = values;
|
|
88 }
|
|
89
|
|
90 private Type _type;
|
|
91 public object Type
|
|
92 {
|
|
93 get { return _type; }
|
|
94 }
|
|
95
|
|
96 private object _origValue;
|
|
97 public object OrigValue
|
|
98 {
|
|
99 get { return _origValue; }
|
|
100 }
|
|
101
|
|
102 private object[] _values;
|
|
103 public object[] Values
|
|
104 {
|
|
105 get { return _values; }
|
|
106 }
|
|
107 }
|
|
108 }
|