0
|
1 using System;
|
|
2 using System.Diagnostics.CodeAnalysis;
|
|
3
|
|
4 namespace BLToolkit.TypeBuilder
|
|
5 {
|
|
6 [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
|
|
7 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)]
|
|
8 public class GlobalInstanceTypeAttribute : InstanceTypeAttribute
|
|
9 {
|
|
10 public GlobalInstanceTypeAttribute(Type propertyType, Type instanceType)
|
|
11 : base(instanceType)
|
|
12 {
|
|
13 _propertyType = propertyType;
|
|
14 }
|
|
15
|
|
16 public GlobalInstanceTypeAttribute(Type propertyType, Type instanceType, object parameter1)
|
|
17 : base(instanceType, parameter1)
|
|
18 {
|
|
19 _propertyType = propertyType;
|
|
20 }
|
|
21
|
|
22 public GlobalInstanceTypeAttribute(Type propertyType, Type instanceType,
|
|
23 object parameter1,
|
|
24 object parameter2)
|
|
25 : base(instanceType, parameter1, parameter2)
|
|
26 {
|
|
27 _propertyType = propertyType;
|
|
28 }
|
|
29
|
|
30 public GlobalInstanceTypeAttribute(Type propertyType, Type instanceType,
|
|
31 object parameter1,
|
|
32 object parameter2,
|
|
33 object parameter3)
|
|
34 : base(instanceType, parameter1, parameter2, parameter3)
|
|
35 {
|
|
36 _propertyType = propertyType;
|
|
37 }
|
|
38
|
|
39 public GlobalInstanceTypeAttribute(Type propertyType, Type instanceType,
|
|
40 object parameter1,
|
|
41 object parameter2,
|
|
42 object parameter3,
|
|
43 object parameter4)
|
|
44 : base(instanceType, parameter1, parameter2, parameter3, parameter4)
|
|
45 {
|
|
46 _propertyType = propertyType;
|
|
47 }
|
|
48
|
|
49 public GlobalInstanceTypeAttribute(Type propertyType, Type instanceType,
|
|
50 object parameter1,
|
|
51 object parameter2,
|
|
52 object parameter3,
|
|
53 object parameter4,
|
|
54 object parameter5)
|
|
55 : base(instanceType, parameter1, parameter2, parameter3, parameter4, parameter5)
|
|
56 {
|
|
57 _propertyType = propertyType;
|
|
58 }
|
|
59
|
|
60 private readonly Type _propertyType;
|
|
61 public Type PropertyType
|
|
62 {
|
|
63 get { return _propertyType; }
|
|
64 }
|
|
65
|
|
66 private Builders.IAbstractTypeBuilder _typeBuilder;
|
|
67 public override Builders.IAbstractTypeBuilder TypeBuilder
|
|
68 {
|
|
69 get
|
|
70 {
|
|
71 if (_typeBuilder == null)
|
|
72 _typeBuilder = new Builders.InstanceTypeBuilder(_propertyType, InstanceType, IsObjectHolder);
|
|
73
|
|
74 return _typeBuilder;
|
|
75 }
|
|
76 }
|
|
77 }
|
|
78 }
|