示例#1
0
        public ScopeSpecification Clone()
        {
            var copy = new ScopeSpecification();

            foreach (var item in this)
            {
                copy.Add(item.Key, new ScopeValue(item.Value));
            }
            return(copy);
        }
        public VariableSetResource AddOrUpdateVariableValue(string name, string value, ScopeSpecification scope)
        {
            var existing = Variables.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase) && x.Scope.Equals(scope));

            if (existing == null)
            {
                var template = new VariableResource
                {
                    Name  = name,
                    Value = value,
                    Scope = scope,
                };

                Variables.Add(template);
            }
            else
            {
                existing.Name  = name;
                existing.Value = value;
                existing.Scope = scope;
            }

            return(this);
        }
 public VariableResource()
 {
     Id    = Guid.NewGuid().ToString();
     Scope = new ScopeSpecification();
 }
示例#4
0
 public bool Equals(ScopeSpecification other)
 {
     return(other.ToString().Equals(ToString()));
 }