fixed webcontrol object naming compatibility issue

fixed factory product caching
This commit is contained in:
eeichinger
2009-07-25 14:03:12 +00:00
parent 4c5675663d
commit a98965e7e5
2 changed files with 13 additions and 7 deletions

View File

@@ -836,7 +836,7 @@ namespace Spring.Objects.Factory.Support
if (factory.IsSingleton && ContainsSingleton(canonicalName))
{
lock (factoryObjectProductCache)
lock (factoryObjectProductCache.SyncRoot)
{
resultInstance = factoryObjectProductCache[canonicalName];
if (resultInstance == null)
@@ -844,14 +844,15 @@ namespace Spring.Objects.Factory.Support
resultInstance = GetObjectFromFactoryObject(factory, canonicalName, rod);
if (resultInstance != null)
{
factoryObjectProductCache.Add(canonicalName, resultInstance);
factoryObjectProductCache[canonicalName] = resultInstance;
}
return resultInstance;
}
}
}
resultInstance = GetObjectFromFactoryObject(factory, canonicalName, rod);
else
{
resultInstance = GetObjectFromFactoryObject(factory, canonicalName, rod);
}
if (resultInstance == null)
{

View File

@@ -58,7 +58,7 @@ namespace Spring.Objects.Factory.Xml
objectName = webObjectNameGenerator.CreatePageDefinitionName(url);
}
// adjust aliases if necessary
// strip leading homepath symbol ('~') from aliases if necessary
for (int ai = 0; ai < aliases.Count; ai++)
{
string alias = (string)aliases[ai];
@@ -70,9 +70,14 @@ namespace Spring.Objects.Factory.Xml
}
else if (strTypeName.EndsWith(".ascx") || strTypeName.EndsWith(".master"))
{
string controlName = webObjectNameGenerator.CreateControlDefinitionName(url);
if (!StringUtils.HasText(objectName))
{
objectName = webObjectNameGenerator.CreateControlDefinitionName(url);
objectName = controlName;
}
else
{
aliases.Add(controlName);
}
}