I just took a look at WindsorHelperFactory and it looks like helpers are
singleton:
/// <summary>
/// Creates the helper.
/// </summary>
/// <param name="helperType">Type of the helper.</param>
/// <param name="engineContext">The engine context.</param>
/// <param name="initialized">if set to <c>true</c> the helper is
already initialized.</param>
/// <returns></returns>
public override object Create(Type helperType, IEngineContext
engineContext, out bool initialized)
{
initialized = false;
if (kernel.HasComponent(helperType))
{
HybridDictionary dict = new HybridDictionary(true);
dict["engineContext"] = engineContext;
dict["serverUtility"] = engineContext.Server;
return kernel.Resolve(helperType);
// return kernel.Resolve(helperType, new { engineContext =
engineContext, serverUtility = engineContext.Server });
}
else
{
return base.Create(helperType, engineContext, out
initialized);
}
}
Is this correct?
On Wed, Jul 15, 2009 at 1:00 PM, Brian Chan <[email protected]> wrote:
> Just to clarify I created a new helper extending FormHelper.
>
> On Wed, Jul 15, 2009 at 12:58 PM, Brian Chan <[email protected]> wrote:
>
>> I think I've realized what's happening. The Helper I'm using has the
>> wrong controller context. Are the helpers supposed to be singletons? One
>> instance for all uses? Or should a new instance be created each time?
>> Because mine is using only once instance and I think that is causing the
>> problem.
>>
>> 2009/7/14 João Bragança <[email protected]>
>>
>>
>>> Which view engine are you using? I think you might be having a name /
>>> key collision. Don't know about nvelocity, but Brail takes query,
>>> form, resources, session, flash, propertybag and helpers and shoves
>>> everything into one IDictionary. So make sure your querystring keys
>>> differ from your propertybag / resource keys.
>>>
>>> On Jul 14, 11:34 am, Brian Chan <[email protected]> wrote:
>>> > All my controllers inherit from a base controller that populates the
>>> > property bag with some common variables such as the current user. It
>>> > happens on many controllers randomly. I am on r5779 of the trunk.
>>> Haven't
>>> > updated recently...
>>> >
>>> > On Mon, Jul 6, 2009 at 3:28 PM, Roelof Blom <[email protected]>
>>> wrote:
>>> > > Is it happening on one specific page only? What "version" (trunk?
>>> RC3?) of
>>> > > MonoRail are you using?
>>> >
>>> > > On Mon, Jul 6, 2009 at 9:12 PM, Brian Chan <[email protected]> wrote:
>>> >
>>> > >> I'm not sure what other information to give. It happens completely
>>> > >> randomly. I open the page once, it works fine. The next time the
>>> page has
>>> > >> a bunch of blanks where the data would have come from the property
>>> bag. I
>>> > >> load the page again and everything is okay. This even affects the
>>> resource
>>> > >> collection for the view.
>>> >
>>> > >> I'm sorry, but can you please suggest what other info would make it
>>> easier
>>> > >> to debug?
>>> >
>>> > >> Thanks.
>>> >
>>> > >> On Fri, Jun 26, 2009 at 3:37 PM, Jason Meckley <
>>> [email protected]>wrote:
>>> >
>>> > >>> I echo Roelof's bluntness :)
>>> >
>>> > >>> That said chances are the problem is what you are doing after you
>>> > >>> place the items in the PropertyBag. There are 3 primary containers
>>> > >>> PropertyBag, Flash and Session.
>>> > >>> The PropertyBag is where you store what you want to render on the
>>> > >>> current view.
>>> > >>> Flash is used most often with returning error messages (not sure
>>> why,
>>> > >>> but it's what all the examples show). I think is survives redirects
>>> > >>> within the same request.
>>> > >>> Session is just that, Session. Use sparingly.
>>> >
>>> > >>> if you load the property bag and then redirect to another, url,
>>> > >>> action, controller, etc. the property bag is lost. either pass the
>>> > >>> values via Flash or through the redirect overload.
>>> > >>> RedirectToAction(name, dictionary);
>>> >
>>> > >>> On Jun 26, 12:23 pm, Roelof Blom <[email protected]> wrote:
>>> > >>> > Magic? The weather? Strange fields of radiation perhaps?
>>> >
>>> > >>> > Honestly, if you want us to help you you need to provide more
>>> info than
>>> > >>> you
>>> > >>> > just did.
>>> >
>>> > >>> > -- Roelof
>>> >
>>> > >>> > On Fri, Jun 26, 2009 at 6:03 PM, Brian Chan <[email protected]>
>>> wrote:
>>> > >>> > > Hi all,
>>> >
>>> > >>> > > I'm currently using Monorail for an application. It seems that
>>> > >>> objects
>>> > >>> > > placed in the property bag vanish randomly and are no longer
>>> present
>>> > >>> when
>>> > >>> > > processing the view. Is there any reason this might be
>>> happening?
>>> >
>>> > >>> > > Thanks.
>>> >>>
>>>
>>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---