@@ -29,51 +29,51 @@ public IAttributeAdapter GetAttributeAdapter(ValidationAttribute attribute, IStr
29
29
30
30
var type = attribute . GetType ( ) ;
31
31
32
- if ( type == typeof ( RegularExpressionAttribute ) )
32
+ if ( typeof ( RegularExpressionAttribute ) . IsAssignableFrom ( type ) )
33
33
{
34
34
adapter = new RegularExpressionAttributeAdapter ( ( RegularExpressionAttribute ) attribute , stringLocalizer ) ;
35
35
}
36
- else if ( type == typeof ( MaxLengthAttribute ) )
36
+ else if ( typeof ( MaxLengthAttribute ) . IsAssignableFrom ( type ) )
37
37
{
38
38
adapter = new MaxLengthAttributeAdapter ( ( MaxLengthAttribute ) attribute , stringLocalizer ) ;
39
39
}
40
- else if ( type == typeof ( RequiredAttribute ) )
40
+ else if ( typeof ( RequiredAttribute ) . IsAssignableFrom ( type ) )
41
41
{
42
42
adapter = new RequiredAttributeAdapter ( ( RequiredAttribute ) attribute , stringLocalizer ) ;
43
43
}
44
- else if ( type == typeof ( CompareAttribute ) )
44
+ else if ( typeof ( CompareAttribute ) . IsAssignableFrom ( type ) )
45
45
{
46
46
adapter = new CompareAttributeAdapter ( ( CompareAttribute ) attribute , stringLocalizer ) ;
47
47
}
48
- else if ( type == typeof ( MinLengthAttribute ) )
48
+ else if ( typeof ( MinLengthAttribute ) . IsAssignableFrom ( type ) )
49
49
{
50
50
adapter = new MinLengthAttributeAdapter ( ( MinLengthAttribute ) attribute , stringLocalizer ) ;
51
51
}
52
- else if ( type == typeof ( CreditCardAttribute ) )
52
+ else if ( typeof ( CreditCardAttribute ) . IsAssignableFrom ( type ) )
53
53
{
54
54
adapter = new DataTypeAttributeAdapter ( ( DataTypeAttribute ) attribute , "data-val-creditcard" , stringLocalizer ) ;
55
55
}
56
- else if ( type == typeof ( StringLengthAttribute ) )
56
+ else if ( typeof ( StringLengthAttribute ) . IsAssignableFrom ( type ) )
57
57
{
58
58
adapter = new StringLengthAttributeAdapter ( ( StringLengthAttribute ) attribute , stringLocalizer ) ;
59
59
}
60
- else if ( type == typeof ( RangeAttribute ) )
60
+ else if ( typeof ( RangeAttribute ) . IsAssignableFrom ( type ) )
61
61
{
62
62
adapter = new RangeAttributeAdapter ( ( RangeAttribute ) attribute , stringLocalizer ) ;
63
63
}
64
- else if ( type == typeof ( EmailAddressAttribute ) )
64
+ else if ( typeof ( EmailAddressAttribute ) . IsAssignableFrom ( type ) )
65
65
{
66
66
adapter = new DataTypeAttributeAdapter ( ( DataTypeAttribute ) attribute , "data-val-email" , stringLocalizer ) ;
67
67
}
68
- else if ( type == typeof ( PhoneAttribute ) )
68
+ else if ( typeof ( PhoneAttribute ) . IsAssignableFrom ( type ) )
69
69
{
70
70
adapter = new DataTypeAttributeAdapter ( ( DataTypeAttribute ) attribute , "data-val-phone" , stringLocalizer ) ;
71
71
}
72
- else if ( type == typeof ( UrlAttribute ) )
72
+ else if ( typeof ( UrlAttribute ) . IsAssignableFrom ( type ) )
73
73
{
74
74
adapter = new DataTypeAttributeAdapter ( ( DataTypeAttribute ) attribute , "data-val-url" , stringLocalizer ) ;
75
75
}
76
- else if ( type == typeof ( FileExtensionsAttribute ) )
76
+ else if ( typeof ( FileExtensionsAttribute ) . IsAssignableFrom ( type ) )
77
77
{
78
78
adapter = new FileExtensionsAttributeAdapter ( ( FileExtensionsAttribute ) attribute , stringLocalizer ) ;
79
79
}
0 commit comments