It's pretty easy to implement this functionality with a session
interceptor:

    public class InjectionInterceptor : EmptyInterceptor
    {
        private readonly WindsorContainer _container;

        public InjectionInterceptor(WindsorContainer container)
        {
            _container = container;
        }

        public override object Instantiate(string clazz, EntityMode
entityMode, object id)
        {
            return _container.Resolve(clazz);
        }
    }

I'd guess that this can be moved to NHib 2.0 events (since we're
moving away from interceptors) but I don't know them well enough yet
to do this immediately.

Cheers,
john

On Nov 20, 3:38 pm, "Lee Henson" <[EMAIL PROTECTED]> wrote:
> Thinking about it, if NH *did* want to have a config source for plugging in
> IoC-instantiated entities, it might be a good opportunity to use that common
> service locator thingy:http://www.codeplex.com/CommonServiceLocator
>
> <nh-config>
>     <add key="instantiator.ioc" value="Castle.Windsor.Whatever,
> Castle.Windsor" />
> </nh-config>
>
> Just some krazy ideas.
>
> 2008/11/20 Fabio Maulo <[EMAIL PROTECTED]>
>
>
>
> > Jen... I ask only to create an example more closer as possible of Lee's
> > environment.
> > There is one thing I had named : "syndrome of obvious"
> > I have discovered that, in our world, there is not so "obvious" things and
> > for that I'm asking.
>
> > 2008/11/20 Ken Egozi <[EMAIL PROTECTED]>
>
> >> but does it make any difference for implementing Lee's feature (and one
> >> that I like to have myself - letting the IoC instantiate persisted
> >> entities)? the implementation should be almost similar for any reasonable
> >> IoC, as the usage (in terms of resolving an instance) is almost identical
> >> across
>
> >> On Thu, Nov 20, 2008 at 4:47 PM, Fabio Maulo <[EMAIL PROTECTED]>wrote:
>
> >>> The second questions was for Ken.Understand: You are using
> >>> Castle.Windsor. I'm a Windsor user too (so far), but a lot of my customers
> >>> are using Spring.Net.
> >>> For me it is not so logical that who are using NH mean that they are
> >>> using Castle.Windsor.
>
> >>> --
> >>> Fabio Maulo
>
> >> --
> >> Ken Egozi.
> >>http://www.kenegozi.com/blog
> >>http://www.delver.com
> >>http://www.musicglue.com
> >>http://www.castleproject.org
> >>http://www.gotfriends.co.il
>
> > --
> > Fabio Maulo- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to