Mercurial > pub > bltoolkit
comparison Source/Mapping/TrimmableAttribute.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.Diagnostics.CodeAnalysis; | |
3 using BLToolkit.Common; | |
4 | |
5 namespace BLToolkit.Mapping | |
6 { | |
7 [AttributeUsage( | |
8 AttributeTargets.Property | AttributeTargets.Field | | |
9 AttributeTargets.Class | AttributeTargets.Interface)] | |
10 public sealed class TrimmableAttribute : Attribute | |
11 { | |
12 public TrimmableAttribute() | |
13 { | |
14 _isTrimmable = true; | |
15 } | |
16 | |
17 public TrimmableAttribute(bool isTrimmable) | |
18 { | |
19 _isTrimmable = isTrimmable; | |
20 } | |
21 | |
22 private readonly bool _isTrimmable; | |
23 public bool IsTrimmable | |
24 { | |
25 get { return _isTrimmable; } | |
26 } | |
27 | |
28 private static TrimmableAttribute GetDefaultTrimmableAttribute() | |
29 { | |
30 return Common.Configuration.TrimOnMapping ? Yes : No; | |
31 } | |
32 | |
33 [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] | |
34 public static readonly TrimmableAttribute Yes = new TrimmableAttribute(true); | |
35 [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] | |
36 public static readonly TrimmableAttribute No = new TrimmableAttribute(false); | |
37 [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] | |
38 public static readonly TrimmableAttribute Default = GetDefaultTrimmableAttribute(); | |
39 } | |
40 } |