Nevermind, I found the error.

public interface ITimerHelperFactory
{
ITimerHelper Create(Action elapsedAction, int interval, Func<TimerHelper,
Exception, bool> exceptionAction);
}
should be using the interface ITimerHelper, not TimerHelper

2011/12/7 Martin Larsen <[email protected]>

> Hi
>
> I have the following code, which was running fine in 2.5.3, but now
> throws a Conversion.ConverterException. I don't understand why that
> is.
>
> public interface ITimerHelperFactory
> {
>        ITimerHelper Create(Action elapsedAction, int interval,
> Func<TimerHelper, Exception, bool> exceptionAction);
> }
>
> public interface ITimerHelper : IDisposable
> {
>        ....
> }
>
> public class TimerHelper : ITimerHelper
> {
>        public TimerHelper(Action elapsedAction, int interval,
> Func<ITimerHelper, Exception, bool> exceptionAction)
>        {
>              ....
>        }
> }
>
> _container.Register(Component.For<ITimerHelperFactory>().AsFactory());
>
> _container.Register(Component.For<ITimerHelper>().ImplementedBy<TimerHelper>().LifeStyle.Transient);
>
> ITimerHelper _persistTimer =
> _container.Resolve<ITimerHelperFactory>().Create(PersistQueueItems,
> 5000, PersistQueueItemsFailed)
>
> private bool PersistQueueItemsFailed(ITimerHelper timer, Exception ex)
> {
>            ...
> }
>
> internal void PersistQueueItems()
> {
>            ...
> }
>
> Exception:
> {"Could not convert expression
>
> 'System.Func`3[QueueIT.FrameWork.Helpers.TimerHelper,System.Exception,System.Boolean]'
> to type 'System.Func`3[[QueueIT.FrameWork.Helpers.ITimerHelper,
> QueueIT.FrameWork, Version=1.3.22.0, Culture=neutral,
> PublicKeyToken=null],[System.Exception, mscorlib, Version=4.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Boolean,
> mscorlib, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089]]'. Expecting a reference override
> like ${some key}"}
>
> It look as if the type 'Func<ITimerHelper, Exception, bool>' is
> causing the issue.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to