I can't remember the exact details of the NHib Facility, but it does seem a
little unusual to put the ISession in the container.   WHen you resolve the
instance, may you should add the ISession in the custom dependnecies
collection and do a Resolve with the custom dependencies.

On Tue, Jun 2, 2009 at 10:50 AM, Andyk <[email protected]> wrote:

>
> Well, I think the problem is simply that Im adding a session generated
> by the SessionManager, into the container, but its not resolving it
> later on.
> A test case might look like:
>
>       [Test]
>       public void Should_resolve_session_provided_by_SessionManager()
>        {
>            IKernel kernel = new DefaultKernel();
>            kernel.Register(Component.For<ITestService>
> ().ImplementedBy<TestService>());
>
>            var session = sessionManager.OpenSession();
>            kernel.AddComponentInstance("NHibernate.Session",session);
>
>            var result = kernel.Resolve<ITestService>();
>        }
>
>        public class TestService:ITestService
>        {
>            private readonly ISession session;
>
>            public TestService (ISession session)
>            {
>                this.session = session;
>            }
>
>            public void DoWork()
>            {
>                throw new NotImplementedException();
>            }
>        }
>        public interface ITestService
>        {
>            void DoWork();
>        }
>
> Is this what you mean?
> >
>

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