Nothing built in, since we don't want to force you to have to reference
Windsor's assembly in your application code, but it's a trivial extension
method and wrapper type, 10 LOC altogether to get this working yourself
--
Krzysztof Kozmic
On Friday, 30 November 2012 at 5:51 AM, Michael S. wrote:
> Hello,
> I've been thinking of some helper component that could save little
> keystrokes. And instead of writing this:
>
> IMyFactory Factory { get; set; }
>
> void foo()
> {
> ISilverOblogon oblogon = Factory.CreateSilverOblogon();
>
> try
> {
> // use oblogon
> }
> finally
> {
> Factory.Release(oblogon);
> }
> }
>
> One could do
>
> FactoryScope<IMyFactory, ISilverOblogon> OblogonFactory { get; set; }
> // FactoryScope has Factory inside injected by container
>
> void bar()
> {
> using (var wrapper = OblogonFactory.AcquireObject())
> // FactoryScope finds and calls CreateSilverOblogon method
> {
> // use wrapper.Object which is ISilverOblogon
> } // wrapper.Dispose calls Factory.Release method
> }
>
> Is there anything like this around? Does it make any sense at all?
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/castle-project-users/-/mGweFc_e_JQJ.
> To post to this group, send email to [email protected]
> (mailto:[email protected]).
> To unsubscribe from this group, send email to
> [email protected]
> (mailto:[email protected]).
> For more options, visit this group at
> http://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.