Thanks for replying.

Referring to CurrentContext will not work because it is only set in
that constructor, which takes IEngineContext but is never fired.
Doesn't really matter. I resorted to using the static properties on
MonoRailHttpHandlerFactory.

What I am more curious is why is Type#GetConstructor behaving the way
it does. I am sure it is by design, but still it seems odd.

Tomasz

On 26 Lis, 18:25, Patrick Steele <[email protected]> wrote:
> Not sure why the factory is written the way it is, but you can get to
> the IEngineContext by simply referring to CurrentContext property of
> your base class (AbstractHelper).
>
> ---
> Patrick Steelehttp://weblogs.asp.net/psteele
>
>
>
>
>
>
>
> On Fri, Nov 26, 2010 at 4:44 AM, Tomek Pluskiewicz <[email protected]> wrote:
> > Hi
>
> > I have just attempted to create a small helper with access to the
> > current IEngineContext. So, I inherited AbstractHelper gave it one
> > constructor:
>
> > public QuerystringHelper(IEngineContext engineContext) :
> > base(engineContext) {...}
>
> > That results in [MissingMethodException: No parameterless constructor
> > defined for this object.] thrown in DefaultHelperFactory. "Why is
> > that?" I thought.
>
> > So I looked into the factory and it turns out that
>
> > ConstructorInfo constructorInfo =
> > helperType.GetConstructor(BindingFlags.Public, null, new Type[]
> > {typeof(IEngineContext)}, null);
>
> > returns null and thus DefaultHelperFactory falls back to invoking the
> > parameterless constructor which I don't have (and I don't want it).
>
> > This whole thing got me pretty confused. Why isn't GetConstructor
> > actually getting the right method? The same thing happens to the built-
> > in helpers when I run the GetConstructor method. On the other hand
> > running GetConstructor(new Type[] {typeof(IEngineContext)}) does work
> > as expected.
>
> > Can anyone tell me what is going on?
>
> > Regards
> > Tomasz
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Castle Project Users" group.> To post to this group, send email 
> > [email protected].> To unsubscribe from this group, 
> > send email [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/castle-project-users?hl=en.

-- 
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