コード例 #1
0
        /// <summary>
        /// 创建实体AOP对象
        /// </summary>
        /// <param name="key"></param>
        /// <param name="aopPosition"></param>
        /// <returns></returns>
        public static List<IEntityAspect> BuildEntityAspect(string key, AopPositionEnum aopPosition)
        {

            List<EntityAopDTO> entityAsectorALL = AspectManager.EntityAsectorCollection[AspectManager.ALL + "$" + aopPosition] as List<EntityAopDTO>;
            List<EntityAopDTO> entityAsectorKey = AspectManager.EntityAsectorCollection[key + "$" + aopPosition] as List<EntityAopDTO>;
            List<IEntityAspect> aspectorList = new List<IEntityAspect>();
            if (entityAsectorALL != null)
            {
                foreach (EntityAopDTO aopDTO in entityAsectorALL)
                {
                    IEntityAspect insector = aopDTO.BuildAspect();
                    if (insector != null)
                    {
                        aspectorList.Add(insector);
                    }
                }
            }
            if (entityAsectorKey != null)
            {
                foreach (EntityAopDTO aopDTO in entityAsectorKey)
                {
                    IEntityAspect insector = aopDTO.BuildAspect();
                    if (insector != null)
                    {
                        aspectorList.Add(insector);
                    }
                }
            }

            return aspectorList;
        }
コード例 #2
0
 public override bool Init(XmlNode el)
 {
     if (!base.Init(el))
     {
         return false;
     }
     string pos = el.Attributes["Position"].Value.ToLower();
     if (pos == "inserting")
     {
         this.AopPosition = AopPositionEnum.Inserting;
     }
     else if (pos == "inserted")
     {
         this.AopPosition = AopPositionEnum.Inserted;
     }
     else if (pos == "updating")
     {
         this.AopPosition = AopPositionEnum.Updating;
     }
     else if (pos == "updated")
     {
         this.AopPosition = AopPositionEnum.Updated;
     }
     else if (pos == "deleting")
     {
         this.AopPosition = AopPositionEnum.Deleting;
     }
     else if (pos == "deleted")
     {
         this.AopPosition = AopPositionEnum.Deleted;
     }
     else
     {
         NHExt.Runtime.Logger.LoggerInstance.RuntimeLogger.Error("没有找到AOP匹配类型");
         return false;
     }
     return true;
 }