Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Objects/Factory/Support
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv2840
Modified Files:
WebObjectFactory.cs
Log Message:
initial solution for SPRNET-824 - WebObjectFactory does not need a valid HttpContext.Current instance anymore as long as no 'session' or 'request' scoped objects are requested.
Index: WebObjectFactory.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Objects/Factory/Support/WebObjectFactory.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** WebObjectFactory.cs 15 Dec 2007 21:21:47 -0000 1.8
--- WebObjectFactory.cs 16 Dec 2007 12:43:48 -0000 1.9
***************
*** 232,235 ****
--- 232,239 ----
else if (scope == ObjectScope.Request)
{
+ if (this.Context == null)
+ {
+ throw new ObjectCreationException(string.Format("Can't create 'request' scoped web singleton object '{0}' without a valid HttpContext.Current instance.", objectName));
+ }
string key = GetObjectKey(objectName);
Request[key] = TemporarySingletonPlaceHolder;
***************
*** 239,247 ****
else if (scope == ObjectScope.Session)
{
IDictionary sessionCache = this.Session;
if (sessionCache == null)
{
! throw ConfigurationUtils.CreateConfigurationException(
! "'session'-scoped objects require SessionState to be enabled.");
}
string key = GetObjectKey(objectName);
--- 243,254 ----
else if (scope == ObjectScope.Session)
{
+ if (this.Context == null)
+ {
+ throw new ObjectCreationException(string.Format("Can't create 'session' scoped web singleton object '{0}' without a valid HttpContext.Current instance.", objectName));
+ }
IDictionary sessionCache = this.Session;
if (sessionCache == null)
{
! throw new ObjectCreationException(string.Format("'session' scoped web singleton object '{0}' require a valid Session.", objectName));
}
string key = GetObjectKey(objectName);
|