bin/projects/dbatools/dbatools/Parameter/ParameterContractAttribute.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
 
namespace Sqlcollaborative.Dbatools.Parameter
{
    /// <summary>
    /// The attribute used to define the elements of a ParameterClass contract
    /// </summary>
    [AttributeUsage(AttributeTargets.All)]
    public class ParameterContractAttribute : Attribute
    {
        private ParameterContractType type;
        private ParameterContractBehavior behavior;
 
        /// <summary>
        /// Returns the type of the element this attribute is supposed to be attached to.
        /// </summary>
        public ParameterContractType Type
        {
            get
            {
                return type;
            }
        }
 
        /// <summary>
        /// Returns the behavior to expect from the contracted element. This sets the expectations on how this element is likely to act.
        /// </summary>
        public ParameterContractBehavior Behavior
        {
            get
            {
                return behavior;
            }
        }
 
        /// <summary>
        /// Ceates a perfectly common parameter contract attribute. For use with all parameter classes' public elements.
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="Behavior"></param>
        public ParameterContractAttribute(ParameterContractType Type, ParameterContractBehavior Behavior)
        {
            type = Type;
            behavior = Behavior;
        }
    }
}