Yes thanks very much.

On another note in terms of design.  If I am injecting interfaces into
controller constructors to resolve a ProductsRepository class to
IProductsRepository in a ProductsController, if later on I then need to make
a check for something in one of the Actions against orders I would then have
to create a new instance of the class eg/OrderRepo orderRepo = new
OrderRepo.  At that point I am now bound to that class rather than the
interface. In this case would you recommend inserting a IOrdersRepository
into the controller constructor, resolve the class with Windsor and then it
can be used in the Action I need?

Hope that makes sense.

Sorry for the newbie questions.

On 13 January 2011 23:58, José F. Romaniello <[email protected]> wrote:

> When the application start it doesn't call OpenSession, it register Isession 
> and his factory method:
>
> Component.For<ISession>()
>       .UsingFactoryMethod(k => k.Resolve<ISessionFactory>().OpenSession())
>
>
> When Windsor need to resolve a component that depends uppon ISession, it 
> calls the factory method (once per request) and inject the ISession in the 
> component.
>
> If windsor needs to resolve another component that depends upon ISession, it 
> will reuse the same session of the request.
>
> Is it clear?
>
>
> 2011/1/13 Jonathan Channon <[email protected]>
>
> Something may have just clicked.
>>
>> When the application starts it calls OpenSession in the
>> PersistanceFacility.
>>
>> Because this is registered as PerWebRequest does that mean for each web
>> request this session is then shared using ISession and then that can be
>> passed to the controller and for that actual HTTP request the session can be
>> used and is then destroyed after the HTTP request?
>>
>> On 13 January 2011 22:35, José F. Romaniello <[email protected]>wrote:
>>
>>> This has nothing to do with IoC, an NHibernate ISession is not an
>>> IdbConnection and there is not a one to one relationship.
>>> The same happen to NHibernate ITransaction not the same than
>>> IdbTransaction.
>>>
>>> 2011/1/13 zippy <[email protected]>
>>>
>>>> if the ISession is regsitered as PerWebRequest does that mean a new
>>>> database connection
>>>>
>>>
>>>  --
>>> 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]<castle-project-users%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/castle-project-users?hl=en.
>>>
>>
>>
>>
>> --
>> Kind Regards,
>> Jonathan Channon
>>
>> See Me     : http://jonathanchannon.com <http://www.jonathanchannon.com>
>> Hear Me    : http://twitter.com/jchannon
>> Speak To Me : [email protected]
>>
>>  --
>> 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]<castle-project-users%[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]<castle-project-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>



-- 
Kind Regards,
Jonathan Channon

See Me     : http://jonathanchannon.com <http://www.jonathanchannon.com>
Hear Me    : http://twitter.com/jchannon
Speak To Me : [email protected]

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