Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/UI
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26957/UI
Modified Files:
Page.cs UserControl.cs
Log Message:
fixed SPRNET-704
fixed SPRNET-705
Index: Page.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/UI/Page.cs,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -d -r1.81 -r1.82
*** Page.cs 3 Aug 2007 08:31:25 -0000 1.81
--- Page.cs 23 Aug 2007 08:27:08 -0000 1.82
***************
*** 1144,1149 ****
protected virtual string GetBindingManagerKey()
{
! Type thisType = this.GetType();
! return CreateSharedStateKey("DataBindingManager") + thisType.GetHashCode();
}
--- 1144,1148 ----
protected virtual string GetBindingManagerKey()
{
! return CreateSharedStateKey("DataBindingManager");
}
***************
*** 1395,1401 ****
private void InitializeMessageSource()
{
- string MessageSourceKey = CreateSharedStateKey("MessageSource");
if (MessageSource == null)
{
if (this.SharedState[MessageSourceKey] == null)
{
--- 1394,1400 ----
private void InitializeMessageSource()
{
if (MessageSource == null)
{
+ string MessageSourceKey = CreateSharedStateKey("MessageSource");
if (this.SharedState[MessageSourceKey] == null)
{
Index: UserControl.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/UI/UserControl.cs,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** UserControl.cs 1 Aug 2007 23:11:01 -0000 1.48
--- UserControl.cs 23 Aug 2007 08:27:08 -0000 1.49
***************
*** 361,377 ****
if (sharedState == null)
{
! Application.Lock();
! try
{
! sharedState = Application[this.GetType().FullName + ".SharedState"] as IDictionary;
! if (sharedState == null)
{
! sharedState = new SynchronizedHashtable();
! Application.Add(this.GetType().FullName + ".SharedState", sharedState);
}
- }
- finally
- {
- Application.UnLock();
}
}
--- 361,383 ----
if (sharedState == null)
{
! string thisTypeKey = this.GetType().FullName + this.GetType().GetHashCode() + ".SharedState";
!
! sharedState = Application[thisTypeKey] as IDictionary;
! if (sharedState==null)
{
! Application.Lock();
! try
{
! sharedState = Application[thisTypeKey] as IDictionary;
! if (sharedState == null)
! {
! sharedState = new SynchronizedHashtable();
! Application.Add(thisTypeKey, sharedState);
! }
! }
! finally
! {
! Application.UnLock();
}
}
}
***************
*** 397,402 ****
protected virtual string GetBindingManagerKey()
{
! Type thisType = this.GetType();
! return thisType.FullName + ".BindingManager" + thisType.GetHashCode();
}
--- 403,407 ----
protected virtual string GetBindingManagerKey()
{
! return "DataBindingManager";
}
***************
*** 635,654 ****
protected void InitializeMessageSource()
{
! if (MessageSource == null)
{
! string key = GetType().FullName + ".MessageSource";
! MessageSource = (IMessageSource) Context.Cache.Get(key);
!
! if (MessageSource == null)
{
! ResourceSetMessageSource defaultMessageSource = new ResourceSetMessageSource();
! ResourceManager rm = GetLocalResourceManager();
! if (rm != null)
{
! defaultMessageSource.ResourceManagers.Add(rm);
}
- Context.Cache.Insert(key, defaultMessageSource);
- MessageSource = defaultMessageSource;
}
}
}
--- 640,668 ----
protected void InitializeMessageSource()
{
! if (this.MessageSource == null)
{
! string key = CreateSharedStateKey("MessageSource");
! IDictionary sharedState = this.SharedState;
! IMessageSource messageSource = sharedState[key] as IMessageSource;
! if (messageSource == null)
{
! lock(sharedState.SyncRoot)
{
! messageSource = sharedState[key] as IMessageSource;
! if (messageSource == null)
! {
! ResourceSetMessageSource defaultMessageSource = new ResourceSetMessageSource();
! defaultMessageSource.UseCodeAsDefaultMessage = true;
! ResourceManager rm = GetLocalResourceManager();
! if (rm != null)
! {
! defaultMessageSource.ResourceManagers.Add(rm);
! }
! sharedState[key] = defaultMessageSource;
! messageSource = defaultMessageSource;
! }
}
}
+ this.MessageSource = messageSource;
}
}
***************
*** 745,748 ****
--- 759,777 ----
#endregion
+ #region Helper Methods
+
+ /// <summary>
+ /// Creates a key for shared state, taking into account whether
+ /// this page belongs to a process or not.
+ /// </summary>
+ /// <param name="key">Key suffix</param>
+ /// <returns>Generated unique shared state key.</returns>
+ protected string CreateSharedStateKey(string key)
+ {
+ return key;
+ }
+
+ #endregion
+
#region Dependency Injection Support
|