Esempio n. 1
0
 public String[] ExecuteCallTimeAspects()
 {
     if (_AspectsCallTime.Count == 0)
     {
         throw new NoCallTimeAsceptException();
     }
     foreach (var item in _AspectsCallTime.OrderByDescending(p => p.Order))
     {
         if (item.Predicate.IsApplicable(this))
         {
             try
             {
                 AspectData.Add(item.Action.GetType().FullName, item.Action.ExecuteAspect(this.AspectData));
                 _ExecutedAspectsName.Add(item.Action.GetType().FullName);
             }
             catch (Exception e)
             {
                 _CancelAspects = true;
                 OnAspectException(item.Action, e);
                 throw e;
             }
         }
     }
     return(_ExecutedAspectsName.ToArray());
 }
Esempio n. 2
0
        public XDocument Serialize(IWordItem[] aspects, IWordItem[] attributes)
        {
            if (aspects is null)
            {
                throw new ArgumentNullException(nameof(aspects));
            }

            if (attributes is null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }

            var data = new AspectData();

            data.Aspects    = aspects.Select(item => item.Text).ToArray();
            data.Attributes = attributes.Select(item => item.Text).ToArray();
            return(data.XmlSerialize());
        }