Ejemplo n.º 1
0
 public override IClassVisitor Extend(IClassVisitor visitor, IBytecodeBehaviorState state, IList <IBytecodeBehavior> remainingPendingBehaviors,
                                      IList <IBytecodeBehavior> cascadePendingBehaviors)
 {
     if ((state.GetContext <EntityEnhancementHint>() == null && state.GetContext <EmbeddedEnhancementHint>() == null))
     {
         return(visitor);
     }
     if (state.GetContext <EntityEnhancementHint>() != null)
     {
         IEntityMetaData metaData = EntityMetaDataProvider.GetMetaData(state.OriginalType);
         visitor = new InterfaceAdder(visitor, typeof(IEntityMetaDataHolder));
         visitor = new EntityMetaDataHolderVisitor(visitor, metaData);
     }
     visitor = new InterfaceAdder(visitor, typeof(IEnhancedType));
     visitor = new GetBaseTypeMethodCreator(visitor);
     return(visitor);
 }
Ejemplo n.º 2
0
        public override IClassVisitor Extend(IClassVisitor visitor, IBytecodeBehaviorState state, IList <IBytecodeBehavior> remainingPendingBehaviors,
                                             IList <IBytecodeBehavior> cascadePendingBehaviors)
        {
            if (state.GetContext <EntityEnhancementHint>() == null)
            {
                return(visitor);
            }
            IEntityMetaData metaData = EntityMetaDataProvider.GetMetaData(state.OriginalType, true);

            if (metaData == null)
            {
                return(visitor);
            }
            if (!IsAnnotationPresent <EntityEqualsAspect>(state.CurrentType))
            {
                return(visitor);
            }
            visitor = new InterfaceAdder(visitor, typeof(IEntityEquals), typeof(IPrintable));
            visitor = new GetIdMethodCreator(visitor, metaData);
            visitor = new GetBaseTypeMethodCreator(visitor);
            visitor = new EntityEqualsVisitor(visitor);
            return(visitor);
        }