Questions tagged [session-per-request]
19 questions
11
votes
3 answers
session-per-request implementation for WCF, NHibernate, and Ninject
I am trying to implement a session-per-request model in my WCF application, and I have read countless documents on this topic, but looks like there is not a complete demonstration of this. I actually came across some very useful articles such as…

salimaabey
- 113
- 1
- 6
8
votes
1 answer
is StructureMap HttpContextScoped necessary?
I saw a code as below in a tutorial of EF code first , MVC and StructureMap to create a Context Per Request pattern:
protected void Application_Start()
{
...
initStructureMap();
}
private static void…

mohsen dorparasti
- 8,107
- 7
- 41
- 61
4
votes
1 answer
nHibernate session per request and exception management
I have a scenario similar to this:
Asp.NET MVC 4 website using nHibernate Session Per Request.
The session is injected using Ninject onto a Repository with the Get and Save methods.
There are a lot of articles talking about Session Per Request and…

Martin Irigaray
- 626
- 9
- 23
4
votes
2 answers
Best practice Hibernate optimistic locking and web application
I have a web application made with Tapestry5 (java webframework) and Hibernate. Now I'm trying to add optimistic locking. So I added a version attribute and the optimistic locking works, so that was easy and fast.
But as my web application works…

Nathan Q
- 1,892
- 17
- 40
3
votes
1 answer
NHibernate problems with a session-per-request MVC appli
I've written a C# MVC 3 with NHibernate as the ORM and I'm having some odd exceptions thrown on most page loads. They seem to mostly relate to closed sessions and the like and I've checked most of the common issues but found little to help. Some of…

James
- 489
- 1
- 5
- 15
3
votes
1 answer
trying to implement session per web request, No current session context configure
As I said in the title I want to implement session per web request.
My session provider is configured like this (I'm not interested in changing this conf.)
public class SessionProvider
{
public static SessionProvider Instance { get;…

Grunf
- 482
- 8
- 21
2
votes
1 answer
Monorail, nhibernate and session-per-request pattern
I need some insights and thoughts about a refactoring I'm about to do to our web-app.
We initially used the session-per-request pattern with NHibernate and ActiveRecord by using the On_BeginRequest / On_EndRequest in the HttpApplication to create…

jishi
- 24,126
- 6
- 49
- 75
2
votes
2 answers
Error when redirect page from Application_Error
I'm trying to do a redirect, I have a singleton class that is my configuration class, picked up the information on this and ride my conectionString, this data I saved in an encrypted file, I am using session-per-request, then before mounting the my…

Pedro Franco
- 1,926
- 1
- 15
- 37
2
votes
0 answers
OpenSessionInView working but not providing its session for @Transactional
I am trying to use Spring MVC 3 and Hibernate 4.1 to get declarative transaction management, providing an open session for the entire length of the request. I only have one "manager" layer for data access, which directly uses the session. This is…

cogline
- 59
- 7
1
vote
1 answer
Error when using Merge() in NHibernate: a different object with the same identifier
I'm using FluentNHibernate and when i make post got this error.
a different object with the same identifier value was already
associated with the session
That is my Controller:
private readonly ITicketAppService _ticketAppService;
public…

Pedro Franco
- 1,926
- 1
- 15
- 37
1
vote
1 answer
How to make a validation of a singleton class in a session per request
I have a configuration class for the first User access in the base will be necessary to place settings and served almost basis using this if firebird or oracle, the settings are saved in an encrypted file and every time I start my application check…

Pedro Franco
- 1,926
- 1
- 15
- 37
1
vote
1 answer
Unit of Work in NHibernate and Session per Request
I think I might have my Unit of Work set up wrong in my architecture. Here is what I currently have (indented to show order):
HttpRequest.Begin()
UnitOfWork.Begin()
Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
Here, I…

Tyler Wright
- 795
- 1
- 9
- 28
1
vote
2 answers
recommendation pattern to use for handling sessions per web requests in mvc using NHibernate
For example.
My session factory is located in MyDomain.SessionProvider class.
Session can be open using ISession session = SessionProvider.Instance.OpenSession()
Step: SessionProvider.cs
public static SessionProvider Instance { get; private set; }
…

Grunf
- 482
- 8
- 21
0
votes
1 answer
Hibernate: Scope of pessimistic locks within transaction
I am using Hibernate for ORM for a game server and just switched from session/transaction per unit of work to session/transaction per request.
Since multiple transactions may conflict with each other I am using pessimistic locking.
The problem is…

elsamuray7
- 79
- 1
- 10
0
votes
2 answers
Hibernate and JSP Transaction per Request
Hey,
I'm building a four tier software system (Presentation - JSP, Problem Domain, Application Logic, Persistence) and I want to have my transactions in hibernate per request so that I am not making a transaction every time i want to do something…

Ben Guenter
- 208
- 3
- 10