Example #1
0
        public static void AddStep(Type workstepType, out WorkStepAttribute attribute)
        {
            attribute = workstepType.GetAttribute <WorkStepAttribute>();
            if (attribute == null)
            {
                throw new ArgumentNullException(string.Format("type {0} must had WorkStepAttribute attribute", workstepType.FullName));
            }

            var uniqueId = attribute.UniqueId;
            var filters  = Steps.Where(ta => ta.Key.UniqueId == uniqueId);

            if (filters.IsNullOrEmpty())
            {
                Steps.Add(new KeyValuePair <WorkStepAttribute, Type>(attribute, workstepType));
                return;
            }

            if (filters.Any(ta => ta.Value != workstepType))
            {
                throw new ArgumentException("duplicate workstep attribute uniqueid {0}", attribute.UniqueId);
            }
        }
Example #2
0
 public static Type Find(WorkStepAttribute attribute)
 {
     return(Find(attribute.UniqueId));
 }