An simple form is register ISessionFactory on DI using singlteton scope and 
register ISession on DI using request scope (resolving it using the 
ISessionFactory registered as singleton).

Then make your controllers dependent on ISession.

On Thursday, November 14, 2019 at 2:04:59 PM UTC-3, Felipe Oriani wrote:
>
> Hi everyone.
>
> I have been working with NHibernate since the 2.x.x and I always use the 
> ORM with the a Session/Transaction per Request with Asp.Net on .Net 
> Framework. It always worked very well on production with a lot of users.
>
> Now, I am starting a new project with ASP.NET Core and I do not have a 
> lot of experience with this new platform. I have been searching on web 
> about how to implement session per request on ASP.NET Core. Could someone 
> share any material or some guids how to implement it?
>
> Do I need to use a middleware? Is there any way to configure the session 
> context and define it on IoC container to inject the ISessionFactory?
>
> Thank you.
>
> -- 
> ______________________________________
> Felipe B Oriani
> [email protected] <javascript:>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nhusers/dcc6d962-0a48-420f-b2c7-ba1515239568%40googlegroups.com.

Reply via email to