There is no problem doing this, but, keep in your mind, if you instance a global filter, it will add a single instance into your application. So, your code check if the _session
object is not null and instance it, but, when you close the session
you still have the reference on the global filter, because it is a single instance, and worst, the session is closed. So, the next access will get a non null object and closed session.
I would keep the DependencyResolver to give me the instance of the session everytime, because you are controlling it in another level (I want to understand you are doing a session per request).
public ISession Session
{
get
{
return DependencyResolver.Current.GetService<ISession>();
}
}
And the asp.net mvc will get the right instance every request.