using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.Serialization; using GitHub.Services.WebApi; namespace GitHub.Build.WebApi { /// /// Represents options for running a phase based on values specified by a list of variables. /// [DataContract] public class VariableMultipliersAgentExecutionOptions : AgentTargetExecutionOptions, IVariableMultiplierExecutionOptions { public VariableMultipliersAgentExecutionOptions() : base(AgentTargetExecutionType.VariableMultipliers) { } internal VariableMultipliersAgentExecutionOptions( ISecuredObject securedObject) : base(AgentTargetExecutionType.VariableMultipliers, securedObject) { MaxConcurrency = 1; ContinueOnError = false; } /// /// The maximum number of agents to use in parallel. /// [DataMember(EmitDefaultValue=true)] [DefaultValue(1)] public Int32 MaxConcurrency { get; set; } /// /// Indicates whether failure on one agent should prevent the phase from running on other agents. /// [DataMember(EmitDefaultValue = true)] public Boolean ContinueOnError { get; set; } /// /// The list of variables used to determine the matrix of phases to run. /// public List Multipliers { get { if (m_multipliers == null) { m_multipliers = new List(); } return m_multipliers; } set { m_multipliers = value; } } [OnDeserialized] private void OnDeserialized(StreamingContext context) { SerializationHelper.Copy(ref m_serializedMultipliers, ref m_multipliers, true); } [OnSerializing] private void OnSerializing(StreamingContext context) { SerializationHelper.Copy(ref m_multipliers, ref m_serializedMultipliers); } [DataMember(Name = "Multipliers", EmitDefaultValue = false)] private List m_serializedMultipliers; private List m_multipliers; } }