public object TryCreate(IReflectionBehaviorFactoryContext context, Type behaviorType)
        {
            IReflectionBehaviorFactory provider;

            if (!storage.TryGetValue(behaviorType, out provider))
            {
                onSearchFactory.TryExecute(behaviorType, out provider);
            }

            return(provider.TryCreate(context, behaviorType));
        }
Ejemplo n.º 2
0
        public object TryCreate(IReflectionBehaviorFactoryContext context, Type behaviorType)
        {
            if (behaviorType != typeof(ReprocessBehavior))
            {
                return(null);
            }

            ReprocessAttribute attribute = context.HandlerType.GetCustomAttribute <ReprocessAttribute>();

            if (attribute == null)
            {
                return(null);
            }

            TimeSpan delay = attribute.DelayBeforeReprocess;

            if (delay != TimeSpan.Zero)
            {
                return(new ReprocessBehavior(attribute.Count, delay));
            }

            return(new ReprocessBehavior(attribute.Count));
        }
 public object TryCreate(IReflectionBehaviorFactoryContext context, Type behaviorType)
 {
     return(new ReprocessBehavior());
 }
 public object TryCreate(IReflectionBehaviorFactoryContext context, Type behaviorType)
 {
     return(Activator.CreateInstance(behaviorType));
 }