Questions tagged [isession]
47 questions
0
votes
1 answer
How to create session with SQL Server in fluent hibernate
I'm getting exception while creating connection with SQL Server.
ISession factory is shown below from which I'm getting exception:
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
…

Siddiqui
- 172
- 1
- 3
- 16
0
votes
1 answer
nhibernate one isession same idbconnection
I have some code doing 2 times session.Get(id) on the same ISession. I can see that the ISession creates 2 idbconnections. I guess this is because of some kind of configuration. I would like it to do the fetch on the same idbconnection. How?

Stig
- 1,974
- 2
- 23
- 50
0
votes
2 answers
nhibernate lazyload creates new isession
Can I prevent nhibernate creating new ISessions when lazy loading? How?
Correction: I mean new IDbConnections. I have implemented my own DriverConnectionProvider and I see it gets called due to lazy loading

Stig
- 1,974
- 2
- 23
- 50
0
votes
2 answers
ActiveRecordBase.FindAll() does not allow first level cache?
NHibernate's first level cache is available when one use same session. ActiveRecordBase.FindAll() each time creates a new ISession. So such a following can not profit from first level cache:
void test1()
{
Car.FindAll();
Car.FindAll();
…

Afshar Mohebi
- 10,479
- 17
- 82
- 126
0
votes
4 answers
NHibernate is loading same object multiple times - please help!
I've just been reading the trace for one of my ASP.NET pages and I've noticed that the page user is being loaded from the database each time the user is required. Since each ISession is supposed to cache objects, I'm really mystified about…

David
- 15,750
- 22
- 90
- 150
0
votes
2 answers
How to Queue The Add Operation in NHibernate?
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…

Mouhong Lin
- 4,402
- 4
- 33
- 48
0
votes
1 answer
IsessionFactory Issue
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…

Steve
- 2,971
- 7
- 38
- 63
0
votes
1 answer
Is SessionScope exact equivalent of ISession?
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?

Afshar Mohebi
- 10,479
- 17
- 82
- 126
0
votes
1 answer
Does NHibernate need no device like Entity Framework's DbSet?
From what I have gathered. the DbSet is a typed entity cache, and on Save, a DbContext polls all DbSets for entities in need of persistence. In NHibernate, the caching and change detection for all entity types are combined in an ISession…

ProfK
- 49,207
- 121
- 399
- 775
0
votes
1 answer
Service Layer: 1 Instance Per Application or Per View Model? (Or: giving each view model its own data context)
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…

Ben Gribaudo
- 5,057
- 1
- 40
- 75
0
votes
1 answer
Does NHibernate's ISession.QueryOver fire any events?
I have only recently learned about the Events system in NHibernate. The documentation says that
Essentially all of the methods of the ISession interface correlate to an event
and yet I cannot find any event that fires when I load a List of…

Rabadash8820
- 2,328
- 3
- 27
- 49
0
votes
1 answer
Proper session (RavenDB/NHibernate) disposal - IoC and web app
I'm using StructureMap and I've configured ISession with HybridHttpOrLocalThreadStorage life cycle. New session is created and injected into controllers on per request basis.
Now, the question I have is about disposal. I've read number of articles…

user981375
- 639
- 1
- 5
- 15
0
votes
1 answer
NServiceBus 3.2 and child containers
I have NServiceBus (3.2.2) setup with Castle Windsor as its builder and I'm also using NHibernate. THe problem I have is that within my handlers if I have multiple repositories that need the NHibernate session, they end up with different…

Francois Joly
- 307
- 2
- 11
0
votes
2 answers
NHibernate ISession: Nothing can be persisted after an Exception
I have a problem with NHibernate ISession. When I try to persist something wrong into Database (e.g saving an entity with duplicate key on XYZ col) and rolling back Transaction; ISession instance goes to a BROKEN/INVALID state which doesn't persist…

Sadegh
- 4,181
- 9
- 45
- 78
-1
votes
1 answer
How to get the NHibernate ISession that is HttpContextScoped by StructureMap
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…

Adam Mikulasev
- 67
- 2