using Newtonsoft.Json; using System; using System.ComponentModel; using System.Runtime.Serialization; namespace GitHub.DistributedTask.Pipelines { /// /// Provides a base set of properties common to all pipeline resource types. /// [DataContract] [EditorBrowsable(EditorBrowsableState.Never)] public abstract class ResourceReference { protected ResourceReference() { } protected ResourceReference(ResourceReference referenceToCopy) { this.Name = referenceToCopy.Name; } /// /// Gets or sets the name of the referenced resource. /// [DataMember(EmitDefaultValue = false)] [JsonConverter(typeof(ExpressionValueJsonConverter))] public ExpressionValue Name { get; set; } public override String ToString() { var name = this.Name; if (name != null) { var s = name.Literal; if (!String.IsNullOrEmpty(s)) { return s; } s = name.Expression; if (!String.IsNullOrEmpty(s)) { return s; } } return null; } } }