Hi,
I have a rather strange error with NHibernate. I am was having error with ISession been shared by across threads and got this resolved by supplying my own ADO.NET connection like:
IDbConnection connection = new SqlConnection(ApplicationConfiguration.ConnectionString);
connection.Open();
ISession...
I just started thinking about using the NHibernate second level cache in one of my apps. I would probably use the NHibernate.Caches.SysCache.SysCacheProvider which relies on ASP.net cache.
Enabling the cache was not a problem, but I am wondering on how to manage the cache e. g. programmatically removing certain entities from the cache e...
We're using nhibernate in and asp.net MVC application.
We are implementing the Session per Request pattern, via a httpModule.
It looks pretty straight forward, but when we run with NHibernate Profiler, it clearly shows that the
sessions are never getting closed.
the pattern seems straight forward...but I don't understand why the sess...
Using NhibernateProfiler we have determined that we are creating an ISession for every http request. However the ISessions never close. We can see in the log where localSession.Close() fires. Is there something in our config file that would cause the session to never close? Are there any other reasons localSession.Close(...
I have NHibernate hooked up in my asp.net mvc app.
Everything works fine, if I DON'T dispose the ISession. I have read however that you should dispose, but when I do, I get random "Session is closed" exceptions.
I am injecting the ISession into my other objects with Windsor.
Here is my current NHModule:
public class NHibernateHttpMod...
Hi all
I'm somewhat new to the MVC framework and in accordance with the following post:
NHibernate with StructureMap I am not sure how to actually get the HttpContextScoped ISession in my controller?
I'm sure there is a simple way to do this but I am unsure.
Also, it's a small project and I don't want to go overboard with Enterprise D...
Hello,
I'm building C#/.Net 3.5 app using three layers: UI (view/view models), service, and data access/persistence.
Service Layer:
Each service layer instance is associated with a unique persistence instance. The service layer references the persistence layer via an interface.
Persistence Layer: Right now, the persistence layer in...
Hello all,
here is my problem: I'm building a desktop application, with the following tools:
Caliburn
Ninject
NHibernate
All my view models and repositories are instanciated with Ninject. My repositories all need an ISession in their constructor.
I'd like to follow ayende's advice concerning the ViewModels: each ViewModel opens a n...
I'm trying to work out how to complete my implementation of the Repository pattern in an ASP.NET web application.
At the moment, I have a repository interface per domain class defining methods for e.g. loading and saving instances of that class.
Each repository interface is implemented by a class which does the NHibernate stuff. Castle...
Hi Friends, I'm developing an application (asp.net mvc) and I'm using ISession per request (in globa.asax I use Bind and Unbind in Begin_Request event and End_Request event). Everything works fine but sometimes (some requests) I don't need to use an ISession (a connection with database).
I'd like to know if is there any way to open an ...
In this question, the user asks the better way to close sessions because he was having some errors.
The most voted answer is Ayende's answer that says:
You should always use session.Dispose(); The other are for very strange occurances
Should I really always call session.Dispose()? Isn't enough to call session.Close()?
...
Is Castle ActiveRecord's SessionScope exact equivalent of NHibernate's ISession? If yes, why Castle ActiveRecord has provided a duplicate feature? If no, what are their differences?
...
Suppose I'm going to do something that needs access to NHibernate's ISession. For example running a Sql query via ISQLQuery or running a LINQ-to-NHibernate via session.Linq<MyType>(). I know there is 2 way to access ISession:
ActiveRecordMediator.GetSessionFactoryHolder().CreateSession()
ActiveRecordMediator.Execute()
What is the p...
I am getting the classic "object reference not set to an instance of a object" error on this line
HttpContext.Items["ISession"] = Configure.GetSessionFactory().OpenSession();
My configure.cs file is as follows
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Cfg;
using Fluen...
Hi guys,
Is there some way to queue the "Add" operation in NHibernate, just like Linq to SQL and Entity Framework does?
I want to add an entity to the repository, but I don't want to save it to the database immediately, because the business logic is complex. I want to submit all changes when I call ITransaction.Commit(), just like Ent...