I pushed the code to a branch:
https://github.com/castleproject/Castle.Windsor/tree/scoped-lifestyle
feel free to comment and contribute. Have a look at tests that document
how that's supposed to work.
On 23/02/2011 12:38 PM, Mauricio Scheffer wrote:
They're actually the same implementation (written by Germán), I merely
pushed it to the Castle.Windsor.Lifestyles repo.
I already pinged Germán to review Stefan's changes.
Cheers,
Mauricio
On Feb 22, 11:28 pm, Krzysztof Koźmic<[email protected]>
wrote:
There's also a scoped lifestyle created by
Mauricio:https://github.com/castleprojectcontrib/Castle.Windsor.Lifestyles/tre...
and another one from
Germán:http://blog.schuager.com/2010/11/contextual-lifestyle-reloaded.html
Would be good to look into those for inspirations too.
I'm moving this discussion into Castle developers group so that everyone
can contribute.
Krzysztof
On 23/02/2011 10:29 AM, Stefan Sedich wrote:
Thanks for the reply, sounds good I will check out your branch.
Cheers
Stefan
2011/2/23 Krzysztof Koźmic<[email protected]
<mailto:[email protected]>>
Hi Stefan,
No I haven't used that in this scenario, and current
implementation is not geared towards multithreaded usage.
I know Craig, whom I add to the thread, used code based on my
prototype in production, so he may have some more insight.
We're now in the process of integrating the scoped lifestyle
directly into Windsor. (well - what that means is it sits in a
branch in my local repository). We have some changes in how
lifestyles and Burdens work in general, pushed to the main
repository, and integrating that would be the next step.
If you have some ideas on how to implement that so that it covers
nicely scenarios like the one you're requiring feel free to go
ahead and do it.
I will push my local branch to the main repository so that anyone
can fork and have a play with it.
cheers,
Krzysztof
On 23/02/2011 10:21 AM, Stefan Sedich wrote:
Hi,
Sorry to email direct but I thought it might be easier, I came
across your impl of the scoped lifestyle:
https://gist.github.com/400979
Have you ever used anything like this in a multi threaded
situation? For example:
_container = new WindsorContainer();
_container.Register(Component.For<Foo>().ImplementedBy<Foo>().LifeStyle.Sco
ped());
ThreadPool.QueueUserWorkItem(Worker);
ThreadPool.QueueUserWorkItem(Worker);
private static void Worker(object state)
{
using (_container.BeginScope())
{
Console.WriteLine(_container.Resolve<Foo>().GetCount());
}
}
The current scoped solution seems to die out adding multiple
items to the cache, assuming multi threading issues, unless I
am missing something more obvious.
Cheers
--
Stefan Sedich
Software Developer
http://weblogs.asp.net/stefansedich
--
You received this message because you are subscribed to the Google Groups "Castle
Project Development List" 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-devel?hl=en.