Questions tagged [isession]
47 questions
25
votes
1 answer
Removing objects from NHibernate second level cache
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…

Max
- 15,693
- 14
- 81
- 131
7
votes
2 answers
NHibernate Evict By Type instead of by instance
I'm migrating an application like this:
Vehicle v = null;
using (ISession session = MyNHibernateSession())
{
v = Vehicle.FindById(1);
}
using (ISession session = MyNHibernateSession())
{
// somwwhere into these4 lines Vehicle comes Finded
…

manuellt
- 669
- 2
- 7
- 19
6
votes
2 answers
What is the correct way to use Unit of Work/Repositories within the business layer?
Having built a small application using the Unit of Work/Repository pattern, I am struggling to understand how to use this properly within my business layer. My application has a a data access layer which can be either NHibernate or the Entity…

JMc
- 971
- 2
- 17
- 26
6
votes
1 answer
Where can I find documentation for NHibernate ISession.Persist()?
NHibernate's ISession exposes a method Persist() with two overloads. I cannot find documentation on this method anywhere. It's not even mentioned in the NHibernate reference material on http://nhibernate.info/doc/nh/en/index.html.
Is this method…

Øyvind
- 1,600
- 1
- 14
- 33
6
votes
1 answer
The factory was disposed and can no longer be used. NHibernatefacility
I have been trying for three days to figure out this NHibernatefacility thing with Castle and wcf and it's really getting frustrating.
After solving a good dozen of errors, i have come to this one which seems pretty obvious but i can't solve.
This…

Pepito Fernandez
- 2,352
- 6
- 32
- 47
4
votes
0 answers
NPE in 'android.media.session.ISession.getController()'
I've noticed this log in my crashlytics:
Caused by java.lang.NullPointerException: Attempt to invoke interface method 'android.media.session.ISessionController android.media.session.ISession.getController()' on a null object reference
at…

Agustín Alcázar
- 61
- 4
4
votes
6 answers
NHibernate ISession.Save() - Why is this persisting my entities immediately?
I am creating a large number of entities with NHibernate, attaching them to my ISession, and then using a transaction to commit my changes to the database. Code sample is below:
ISession _context = SessionProvider.OpenSession();
//Create new…

JMc
- 971
- 2
- 17
- 26
4
votes
3 answers
How to pass unit of work container into constructor of repository using dependency injection
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…

David
- 15,750
- 22
- 90
- 150
4
votes
5 answers
Create an instance of ISession per ViewModel
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…

Emidee
- 1,245
- 1
- 14
- 33
3
votes
3 answers
How to dispose NHibernate ISession in an ASP.NET MVC App
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…

Joe Young
- 1,076
- 1
- 14
- 27
3
votes
1 answer
Cyclic dependency with Castle Windsor IoC for NHibernate ISession
I am using Castle Windsor for my IoC along with NHIbernate in an ASP.NET MVC app. It works great registered as follows (with one…

Ted
- 7,122
- 9
- 50
- 76
2
votes
1 answer
EF4 ObjectContext vs NHibernate Session
I'm trying to learn some NHibernate after diving into EF4. Is the equivalent of the EF4 ObjectContext (or DbContext) the NHibernate Session?
Specifically, in EF4, you derive from ObjectContext (or DbContext) and your class contains explicit…

anon
- 4,578
- 3
- 35
- 54
2
votes
1 answer
Entities fetched as ReadOnly in NHibernate are present in PersistenceContext
I'm working on a project which uses NHibernate as an ORM.
A fairly large number of entities can be loaded into the session as 'readonly' since they should not be updated after retrieval.
I've tried to do this in 2 different ways:
var entity =…

Frederik Gheysels
- 56,135
- 11
- 101
- 154
1
vote
2 answers
Is there a way to find saved items when using SaveOrUpdate method in nhibernate?
Is there a way to find saved items when using SaveOrUpdate method in hibernate. Basically, I need to know if an item is just updated or it is actualy inserted within one session.
Thansk.

Meisam Emamjome
- 508
- 5
- 15
1
vote
1 answer
Cannot apply indexing with [] to an expression of type "ISession"
Problem arises in this snippet, but i dont really know why(code is from a tutorial
https://www.youtube.com/watch?v=b0CrSerID1A&list=PLjCTEYO9N-j0wMr_p9j92lfgbY4E9c_Ds&index=16
PICTURE of problem
public string GetCartId(HttpContext context)
…

Emils Legzdins
- 27
- 7