comparison Source/Aspects/InterceptorAttribute.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
3 using BLToolkit.TypeBuilder.Builders;
4
5 namespace BLToolkit.Aspects
6 {
7 [AttributeUsage(
8 AttributeTargets.Class |
9 AttributeTargets.Interface |
10 AttributeTargets.Property |
11 AttributeTargets.Method,
12 AllowMultiple=true)]
13 public class InterceptorAttribute : AbstractTypeBuilderAttribute
14 {
15 public InterceptorAttribute(Type interceptorType, InterceptType interceptType)
16 : this(interceptorType, interceptType, null, TypeBuilderConsts.Priority.Normal)
17 {
18 }
19
20 public InterceptorAttribute(Type interceptorType, InterceptType interceptType, int priority)
21 : this(interceptorType, interceptType, null, priority)
22 {
23 }
24
25 public InterceptorAttribute(Type interceptorType, InterceptType interceptType, string parameters)
26 : this(interceptorType, interceptType, parameters, TypeBuilderConsts.Priority.Normal)
27 {
28 }
29
30 public InterceptorAttribute(
31 Type interceptorType, InterceptType interceptType, string configString, int priority)
32 : this(interceptorType, interceptType, configString, priority, false)
33 {
34 }
35
36 public InterceptorAttribute(
37 Type interceptorType, InterceptType interceptType, string configString, int priority, bool localInterceptor)
38 {
39 if (interceptorType == null && interceptType != 0)
40 throw new ArgumentNullException("interceptorType");
41
42 _interceptorType = interceptorType;
43 _interceptType = interceptType;
44 _configString = configString;
45 _priority = priority;
46 _localInterceptor = localInterceptor;
47 }
48
49 private readonly Type _interceptorType;
50 public virtual Type InterceptorType
51 {
52 get { return _interceptorType; }
53 }
54
55 private readonly InterceptType _interceptType;
56 public virtual InterceptType InterceptType
57 {
58 get { return _interceptType; }
59 }
60
61 private readonly int _priority;
62 public virtual int Priority
63 {
64 get { return _priority; }
65 }
66
67 private readonly string _configString;
68 public virtual string ConfigString
69 {
70 get { return _configString; }
71 }
72
73 private readonly bool _localInterceptor;
74 public virtual bool LocalInterceptor
75 {
76 get { return _localInterceptor; }
77 }
78
79 public override IAbstractTypeBuilder TypeBuilder
80 {
81 get
82 {
83 return new Builders.InterceptorAspectBuilder(
84 InterceptorType, InterceptType, ConfigString, Priority, LocalInterceptor);
85 }
86 }
87 }
88 }