Mercurial > pub > bltoolkit
comparison Source/Aspects/InterceptCallInfo.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.Diagnostics; | |
4 using System.Security.Principal; | |
5 using System.Threading; | |
6 using BLToolkit.Properties; | |
7 | |
8 namespace BLToolkit.Aspects | |
9 { | |
10 [DebuggerStepThrough] | |
11 public sealed class InterceptCallInfo | |
12 { | |
13 public InterceptCallInfo() | |
14 { | |
15 _currentPrincipal = Thread.CurrentPrincipal; | |
16 _currentThread = Thread.CurrentThread; | |
17 } | |
18 | |
19 private CallMethodInfo _callMethodInfo; | |
20 public CallMethodInfo CallMethodInfo | |
21 { | |
22 get { return _callMethodInfo; } | |
23 set | |
24 { | |
25 if (_callMethodInfo == value) | |
26 { | |
27 // A race condition. | |
28 // | |
29 return; | |
30 } | |
31 | |
32 if (_callMethodInfo != null) | |
33 throw new InvalidOperationException(Resources.InterceptCallInfo_CallMethodInfoIsNotMutable); | |
34 | |
35 _callMethodInfo = value; | |
36 | |
37 int len = value.MethodInfo.GetParameters().Length; | |
38 | |
39 _parameterValues = len == 0? _emptyValues: new object[len]; | |
40 } | |
41 } | |
42 | |
43 private readonly object[] _emptyValues = new object[0]; | |
44 | |
45 private object[] _parameterValues; | |
46 public object[] ParameterValues | |
47 { | |
48 get { return _parameterValues; } | |
49 set { _parameterValues = value; } | |
50 } | |
51 | |
52 private object _returnValue; | |
53 public object ReturnValue | |
54 { | |
55 get { return _returnValue; } | |
56 set { _returnValue = value; } | |
57 } | |
58 | |
59 private InterceptResult _interceptResult = InterceptResult.Continue; | |
60 public InterceptResult InterceptResult | |
61 { | |
62 get { return _interceptResult; } | |
63 set { _interceptResult = value; } | |
64 } | |
65 | |
66 private InterceptType _interceptType; | |
67 public InterceptType InterceptType | |
68 { | |
69 get { return _interceptType; } | |
70 set { _interceptType = value; } | |
71 } | |
72 | |
73 private Exception _exception; | |
74 public Exception Exception | |
75 { | |
76 get { return _exception; } | |
77 set { _exception = value; } | |
78 } | |
79 | |
80 private Hashtable _items; | |
81 public IDictionary Items | |
82 { | |
83 get | |
84 { | |
85 if (_items == null) | |
86 _items = new Hashtable(); | |
87 | |
88 return _items; | |
89 } | |
90 } | |
91 | |
92 private readonly DateTime _beginCallTime = DateTime.Now; | |
93 public DateTime BeginCallTime | |
94 { | |
95 get { return _beginCallTime; } | |
96 } | |
97 | |
98 private readonly IPrincipal _currentPrincipal; | |
99 public IPrincipal CurrentPrincipal | |
100 { | |
101 get { return _currentPrincipal; } | |
102 } | |
103 | |
104 private readonly Thread _currentThread; | |
105 public Thread CurrentThread | |
106 { | |
107 get { return _currentThread; } | |
108 } | |
109 | |
110 private bool _cached; | |
111 public bool Cached | |
112 { | |
113 get { return _cached; } | |
114 set { _cached = value; } | |
115 } | |
116 | |
117 private object _object; | |
118 public object Object | |
119 { | |
120 get { return _object; } | |
121 set { _object = value; } | |
122 } | |
123 } | |
124 } |