SPRNET-1460: Drop Framework 1.x Support

This commit is contained in:
Marko Lahma
2011-08-15 19:49:17 +03:00
parent ffdeea9d8d
commit de5b921407
80 changed files with 213 additions and 31027 deletions

View File

@@ -8,11 +8,7 @@ using System.Reflection;
// associated with an assembly.
//
#if !NET_2_0
[assembly: AssemblyConfiguration("net-1.1.win32; Release")]
#else
[assembly: AssemblyConfiguration("net-2.0.win32; Release")]
#endif
[assembly: AssemblyCompany("http://www.springframework.net")]
[assembly: AssemblyProduct("Spring.NET Framework 1.3.1")]
[assembly: AssemblyCopyright("Copyright 2002-2011 Spring.NET Framework Team.")]
@@ -42,10 +38,6 @@ using System.Reflection;
[assembly: AssemblyVersion("1.3.2.30001")]
#elif NET_2_0
[assembly: AssemblyVersion("1.3.2.20001")]
#elif NET_1_1
[assembly: AssemblyVersion("1.3.2.11001")]
#elif NET_1_0
[assembly: AssemblyVersion("1.3.2.10001")]
#endif

View File

@@ -18,7 +18,6 @@
#endregion
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
@@ -41,17 +40,3 @@ using System.Security;
[assembly: SecurityCritical]
#endif
#if NET_1_0 || NET_1_1
namespace System.Security
{
///<summary>
///</summary>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Method)]
internal class SecurityCriticalAttribute : Attribute
{ }
[AttributeUsage(AttributeTargets.Method)]
internal class SecurityTreatAsSafeAttribute : Attribute
{ }
}
#endif

View File

@@ -141,15 +141,11 @@ namespace Spring.Context.Support
/// </exception>
protected override void ApplyResourcesToObject(object value, string objectName, CultureInfo culture)
{
#if !NET_1_0
if(value != null)
{
ComponentResourceManager crm = new ComponentResourceManager(value.GetType());
crm.ApplyResources(value, objectName, culture);
}
#else
throw new NotSupportedException("Operation not supported in .NET 1.0 Release.");
#endif
}
/// <summary>

View File

@@ -128,14 +128,10 @@ namespace Spring.Context.Support
/// <seealso cref="Spring.Context.Support.AbstractMessageSource.ApplyResourcesToObject(object, string, CultureInfo)"/>
protected override void ApplyResourcesToObject(object value, string objectName, CultureInfo cultureInfo)
{
#if !NET_1_0
if(value != null)
{
new ComponentResourceManager(value.GetType()).ApplyResources(value, objectName, cultureInfo);
}
#else
throw new System.NotSupportedException("Operation not supported in .NET 1.0 Release.");
#endif
}
/// <summary>

View File

@@ -30,58 +30,9 @@ using System.Text.RegularExpressions;
namespace Spring.Core.TypeConversion
{
#region Specifier parsers
#if NET_1_1
/// <summary>
/// Nullable TimeSpan
/// </summary>
/// <remarks>
/// Can be replaced with a TimeSpan? in .NET 2
/// </remarks>
class TimeSpanNullable {
readonly bool _hasValue;
readonly TimeSpan _value;
/// <summary>
/// ctor without Value;
/// </summary>
public TimeSpanNullable() {
_hasValue = false;
}
/// <summary>
/// ctor with Value
/// </summary>
/// <param name="timeSpan"></param>
public TimeSpanNullable(TimeSpan timeSpan) {
_hasValue = true;
_value = timeSpan;
}
/// <summary>
/// HasValue
/// </summary>
public bool HasValue {
get { return _hasValue; }
}
/// <summary>
/// Value if HasValue==true
/// </summary>
public TimeSpan Value {
get { return _value; }
}
}
#else
using TimeSpanNullable = Nullable<TimeSpan>;
#endif
/// <summary>
/// Base parser for <see cref="TimeSpanConverter"/> custom specifiers.
/// </summary>

View File

@@ -62,7 +62,6 @@ namespace Spring.Globalization.Localizers
/// <returns>A list of resources to apply.</returns>
protected override IList LoadResources(object target, IMessageSource messageSource, CultureInfo culture)
{
#if ! NET_1_0
IList resources;
resources = new ArrayList();
@@ -102,10 +101,6 @@ namespace Spring.Globalization.Localizers
}
}
return resources;
#else
throw new NotSupportedException("Operation not supported in .NET 1.0 Release.");
#endif
}
}
}

View File

@@ -318,14 +318,13 @@ namespace Spring.Objects.Factory.Config
return ((IConfigurationSectionHandler)handler).Create(null, null, sectionContent);
}
#if !NET_1_0 && !NET_1_1
// NET 2.0 ConfigurationSection
if (typeof(ConfigurationSection).IsAssignableFrom(handlerType))
{
ConfigurationSection section = CreateConfigurationSection(handlerType, new XmlNodeReader(sectionContent));
return section;
}
#endif
// Not supported
throw ConfigurationUtils.CreateConfigurationException("Configuration section '" + configSectionName + "' is neither of type IConfigurationSectionHandler nor ConfigurationSection.");
}
@@ -379,7 +378,6 @@ namespace Spring.Objects.Factory.Config
}
#if !NET_1_0 && !NET_1_1
private delegate void DeserializeSectionMethod(ConfigurationSection section, XmlReader reader);
private static DeserializeSectionMethod deserialized = (DeserializeSectionMethod)Delegate.CreateDelegate(typeof(DeserializeSectionMethod),
typeof(ConfigurationSection).GetMethod("DeserializeSection",
@@ -392,7 +390,6 @@ namespace Spring.Objects.Factory.Config
deserialized(section, reader);
return section;
}
#endif
/// <summary>
/// Populates the supplied <paramref name="properties"/> with values from

View File

@@ -179,28 +179,12 @@ namespace Spring.Objects.Factory.Support
{
this.log = LogManager.GetLogger(this.GetType());
this.caseSensitive = caseSensitive;
#if NET_1_0 || NET_1_1
if (caseSensitive)
{
this.aliasMap = new Hashtable();
this.singletonCache = new Hashtable();
this.singletonLocks = new Hashtable();
this.singletonsInCreation = new Hashtable();
}
else
{
this.aliasMap = new CaseInsensitiveHashtable();
this.singletonCache = new CaseInsensitiveHashtable();
this.singletonLocks = new CaseInsensitiveHashtable();
this.singletonsInCreation = new CaseInsensitiveHashtable();
}
#else
IEqualityComparer comparer = (caseSensitive) ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase;
this.aliasMap = new OrderedDictionary(comparer);
this.singletonCache = new OrderedDictionary(comparer);
this.singletonLocks = new OrderedDictionary(comparer);
this.singletonsInCreation = new OrderedDictionary(comparer);
#endif
this.prototypesInCreation = new LogicalThreadContextSetVariable();
}
@@ -1941,14 +1925,8 @@ namespace Spring.Objects.Factory.Support
try
{
string objectName = TransformedObjectName(name);
#if NET_1_1
lock (monitor)
{
nestingCount++;
}
#else
Interlocked.Increment(ref nestingCount);
#endif
#region Instrumentation
if (log.IsDebugEnabled)
{

View File

@@ -998,11 +998,8 @@ namespace Spring.Objects.Factory.Support
{
string[] candidateNames =
ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(this, requiredType, true, descriptor.Eager);
#if NET_1_0 || NET_1_1
IDictionary result = new Hashtable();
#else
IDictionary result = new OrderedDictionary(candidateNames.Length);
#endif
foreach (DictionaryEntry entry in resolvableDependencies)
{
Type autoWiringType = (Type)entry.Key;

View File

@@ -243,7 +243,6 @@ namespace Spring.Objects.Factory.Support
/// <returns>The number of object definitions registered.</returns>
public int RegisterObjectDefinitions(ResourceSet rs, string prefix)
{
#if ! NET_1_0
// Simply create a map and call overloaded method
IDictionary id = new Hashtable();
foreach (DictionaryEntry de in rs)
@@ -251,9 +250,6 @@ namespace Spring.Objects.Factory.Support
id.Add(de.Key, de.Value);
}
return RegisterObjectDefinitions(id, prefix);
#else
throw new NotSupportedException("Operation not supported on NET 1.0");
#endif
}
/// <summary>

View File

@@ -402,17 +402,8 @@ namespace Spring.Objects.Factory.Xml
IResource schema = resourceLoader.GetResource(schemaLocation);
try
{
#if NET_1_0
XmlTextReader schemaDocument = new XmlTextReader(schemaLocation, schema.InputStream);
schemas.Add(namespaceUri, schemaDocument);
#elif NET_1_1
XmlTextReader schemaDocument = new XmlTextReader(schemaLocation, schema.InputStream);
schemas.Add(namespaceUri, schemaDocument, new XmlResourceUrlResolver());
#else
XmlTextReader schemaDocument = new XmlTextReader(schema.Uri.AbsoluteUri, schema.InputStream);
schemas.Add(namespaceUri, schemaDocument);
#endif
}
catch (Exception e)
{

View File

@@ -59,9 +59,6 @@ namespace Spring.Util
/// <returns>Object created by a corresponding <see cref="IConfigurationSectionHandler"/>.</returns>
public static object GetSection(string sectionName)
{
#if !NET_2_0
return ConfigurationSettings.GetConfig(sectionName.TrimEnd('/'));
#else
try
{
return ConfigurationManager.GetSection(sectionName.TrimEnd('/'));
@@ -72,9 +69,8 @@ namespace Spring.Util
}
catch (Exception ex)
{
throw ConfigurationUtils.CreateConfigurationException(string.Format("Error reading section {0}", sectionName), ex);
throw CreateConfigurationException(string.Format("Error reading section {0}", sectionName), ex);
}
#endif
}
/// <summary>
@@ -94,11 +90,7 @@ namespace Spring.Util
/// <param name="sectionName">Name of the configuration section.</param>
public static void RefreshSection(string sectionName)
{
#if !NET_2_0
// TODO : Add support for .NET 1.x
#else
ConfigurationManager.RefreshSection(sectionName);
#endif
}
/// <summary>
@@ -111,11 +103,7 @@ namespace Spring.Util
/// <returns>Configuration exception.</returns>
public static Exception CreateConfigurationException(string message, Exception inner, string fileName, int line)
{
#if !NET_2_0
return new ConfigurationException(message, inner, fileName, line);
#else
return new ConfigurationErrorsException(message, inner, fileName, line);
#endif
}
/// <summary>
@@ -139,11 +127,7 @@ namespace Spring.Util
/// <returns>Configuration exception.</returns>
public static Exception CreateConfigurationException(string message, Exception inner, XmlNode node)
{
#if !NET_2_0
return new ConfigurationException(message, inner, node);
#else
return new ConfigurationErrorsException(message, inner, node);
#endif
}
/// <summary>
@@ -165,11 +149,7 @@ namespace Spring.Util
/// <returns>Configuration exception.</returns>
public static Exception CreateConfigurationException(string message, Exception inner)
{
#if !NET_2_0
return new ConfigurationException(message, inner);
#else
return new ConfigurationErrorsException(message, inner);
#endif
}
/// <summary>
@@ -200,11 +180,7 @@ namespace Spring.Util
/// </returns>
public static bool IsConfigurationException(Exception exception)
{
#if !NET_2_0
return exception is ConfigurationException;
#else
return exception is ConfigurationErrorsException;
#endif
}
/// <summary>
@@ -218,11 +194,7 @@ namespace Spring.Util
{
return ((ITextPosition)node).LineNumber;
}
#if !NET_2_0
return ConfigurationException.GetXmlNodeLineNumber(node);
#else
return ConfigurationErrorsException.GetLineNumber(node);
#endif
}
/// <summary>
@@ -236,11 +208,7 @@ namespace Spring.Util
{
return ((ITextPosition)node).Filename;
}
#if !NET_2_0
return ConfigurationException.GetXmlNodeFilename(node);
#else
return ConfigurationErrorsException.GetFilename(node);
#endif
}
@@ -304,7 +272,6 @@ namespace Spring.Util
/// </summary>
public static void ResetConfigurationSystem()
{
#if NET_2_0
if (SystemUtils.MonoRuntime)
{
return;
@@ -312,18 +279,6 @@ namespace Spring.Util
FieldInfo initStateRef = typeof(ConfigurationManager).GetField("s_initState", BindingFlags.NonPublic | BindingFlags.Static);
object notStarted = Activator.CreateInstance(initStateRef.FieldType);
initStateRef.SetValue(null, notStarted);
#endif
#if NET_1_1
FieldInfo initStateRef = typeof(ConfigurationSettings).GetField("_initState",BindingFlags.NonPublic|BindingFlags.Static);
object notStarted = Activator.CreateInstance(initStateRef.FieldType);
initStateRef.SetValue(null,notStarted);
#endif
#if NET_1_0
FieldInfo initStateRef = typeof(ConfigurationSettings).GetField("_configurationInitialized",BindingFlags.NonPublic|BindingFlags.Static);
FieldInfo configSystemRef = typeof(ConfigurationSettings).GetField("_configSystem",BindingFlags.NonPublic|BindingFlags.Static);
initStateRef.SetValue(null,false);
configSystemRef.SetValue(null,null);
#endif
}
// private static T CreateDelegate<T>(MethodInfo method)
// {

View File

@@ -118,11 +118,7 @@ namespace Spring.Util
}
else
{
#if NET_1_0 || NET_1_1
return Thread.CurrentThread.GetHashCode().ToString();
#else
return Thread.CurrentThread.ManagedThreadId.ToString();
#endif
}
}
}

View File

@@ -127,11 +127,7 @@ namespace Spring.Data.NHibernate
public IApplicationContext ApplicationContext
{
set { this.applicationContext = value; }
#if NET_1_1
get { return this.applicationContext; }
#else
protected get { return this.applicationContext; }
#endif
}
/// <summary>

View File

@@ -18,8 +18,6 @@
#endregion
#if (!NET_1_0)
#region Imports
using System;
@@ -397,5 +395,3 @@ namespace Spring.Data.Core
}
}
}
#endif // (!NET_1_0)

View File

@@ -18,8 +18,6 @@
#endregion
#if (!NET_1_0)
using System.EnterpriseServices;
namespace Spring.Data.Support
@@ -91,4 +89,3 @@ namespace Spring.Data.Support
}
}
}
#endif

View File

@@ -18,8 +18,6 @@
#endregion
#if (!NET_1_0)
using System.EnterpriseServices;
namespace Spring.Data.Support
@@ -72,5 +70,3 @@ namespace Spring.Data.Support
}
}
#endif

View File

@@ -18,8 +18,6 @@
#endregion
#if (!NET_1_0)
using System.EnterpriseServices;
namespace Spring.Data.Support
@@ -123,4 +121,3 @@ namespace Spring.Data.Support
}
}
}
#endif

View File

@@ -18,7 +18,7 @@
#endregion
#if (!NET_1_0 && !MONO)
#if !MONO
#region Imports
@@ -614,4 +614,4 @@ namespace Spring.EnterpriseServices
}
}
#endif // (!NET_1_0)
#endif // (!MONO)

View File

@@ -18,7 +18,7 @@
#endregion
#if (!NET_1_0 && !MONO)
#if !MONO
#region Imports

View File

@@ -18,7 +18,7 @@
#endregion
#if (!NET_1_0 && !MONO)
#if !MONO
#region Imports
@@ -353,4 +353,4 @@ namespace Spring.EnterpriseServices
}
}
#endif // (!NET_1_0)
#endif // !MONO

View File

@@ -1,179 +1,176 @@
#region License
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#if (!NET_1_0 && !MONO)
#region Imports
#region License
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#if !MONO
#region Imports
using System;
using System.Diagnostics;
using System.Reflection;
using Spring.Util;
using Spring.Objects.Factory;
using Spring.Objects.Factory.Support;
using Spring.Objects.Factory.Config;
#endregion
namespace Spring.EnterpriseServices
{
/// <summary>
/// Factory Object that instantiates and configures ServicedComponent.
/// </summary>
/// <remarks>
/// <p>
/// This factory object should be used to instantiate and configure
/// serviced components created by <see cref="ServicedComponentExporter"/>.
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
public class ServicedComponentFactory : IConfigurableFactoryObject, IInitializingObject
{
#region Fields
private string name;
private string server;
private bool isSingleton;
private IObjectDefinition productTemplate;
private Type componentType;
private object singletonInstance;
#endregion
#region Constructor(s) / Destructor
/// <summary>
/// Creates new instance of serviced component factory.
/// </summary>
public ServicedComponentFactory()
{
this.isSingleton = false;
}
#endregion
#region Properties
/// <summary>
/// Gets or sets component name, as registered with COM+ Services.
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
/// <summary>
/// Gets or sets name of the remote server that COM+ component is registered with.
/// </summary>
public string Server
{
get { return server; }
set { server = value; }
}
#endregion
#region IConfigurableFactoryObject Members
/// <summary>
/// Returns configured instance of the serviced component.
/// </summary>
/// <returns>Configured instance of the serviced component.</returns>
public object GetObject()
{
if (IsSingleton)
{
if (singletonInstance == null)
{
singletonInstance = CreateInstance();
}
return singletonInstance;
}
else
{
return CreateInstance();
}
}
/// <summary>
/// Returns type of serviced component.
/// </summary>
public Type ObjectType
{
get { return componentType; }
}
/// <summary>
/// Gets or sets whether serviced component should be treated as singleton. Default is <b>false</b>.
/// </summary>
public bool IsSingleton
{
get { return isSingleton; }
set { isSingleton = value; }
}
/// <summary>
/// Gets or sets the template object definition
/// that should be used to configure proxy instance.
/// </summary>
public IObjectDefinition ProductTemplate
{
get { return productTemplate; }
set { productTemplate = value; }
}
#endregion
#region IInitializingObject Members
/// <summary>
/// Initializes factory object.
/// </summary>
public void AfterPropertiesSet()
{
ValidateConfiguration();
using Spring.Objects.Factory;
using Spring.Objects.Factory.Config;
#endregion
namespace Spring.EnterpriseServices
{
/// <summary>
/// Factory Object that instantiates and configures ServicedComponent.
/// </summary>
/// <remarks>
/// <p>
/// This factory object should be used to instantiate and configure
/// serviced components created by <see cref="ServicedComponentExporter"/>.
/// </p>
/// </remarks>
/// <author>Aleksandar Seovic</author>
public class ServicedComponentFactory : IConfigurableFactoryObject, IInitializingObject
{
#region Fields
private string name;
private string server;
private bool isSingleton;
private IObjectDefinition productTemplate;
private Type componentType;
private object singletonInstance;
#endregion
#region Constructor(s) / Destructor
/// <summary>
/// Creates new instance of serviced component factory.
/// </summary>
public ServicedComponentFactory()
{
this.isSingleton = false;
}
#endregion
#region Properties
/// <summary>
/// Gets or sets component name, as registered with COM+ Services.
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
/// <summary>
/// Gets or sets name of the remote server that COM+ component is registered with.
/// </summary>
public string Server
{
get { return server; }
set { server = value; }
}
#endregion
#region IConfigurableFactoryObject Members
/// <summary>
/// Returns configured instance of the serviced component.
/// </summary>
/// <returns>Configured instance of the serviced component.</returns>
public object GetObject()
{
if (IsSingleton)
{
if (singletonInstance == null)
{
singletonInstance = CreateInstance();
}
return singletonInstance;
}
else
{
return CreateInstance();
}
}
/// <summary>
/// Returns type of serviced component.
/// </summary>
public Type ObjectType
{
get { return componentType; }
}
/// <summary>
/// Gets or sets whether serviced component should be treated as singleton. Default is <b>false</b>.
/// </summary>
public bool IsSingleton
{
get { return isSingleton; }
set { isSingleton = value; }
}
/// <summary>
/// Gets or sets the template object definition
/// that should be used to configure proxy instance.
/// </summary>
public IObjectDefinition ProductTemplate
{
get { return productTemplate; }
set { productTemplate = value; }
}
#endregion
#region IInitializingObject Members
/// <summary>
/// Initializes factory object.
/// </summary>
public void AfterPropertiesSet()
{
ValidateConfiguration();
componentType = Type.GetTypeFromProgID(Name, Server);
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
}
#endregion
#region Private Methods
private void ValidateConfiguration()
{
if (Name == null)
{
throw new ArgumentException("The Name property is required.");
}
}
/// <summary>
/// Creates new instance of serviced component.
/// </summary>
/// <returns>New instance of serviced component.</returns>
private object CreateInstance()
{
}
#endregion
#region Private Methods
private void ValidateConfiguration()
{
if (Name == null)
{
throw new ArgumentException("The Name property is required.");
}
}
/// <summary>
/// Creates new instance of serviced component.
/// </summary>
/// <returns>New instance of serviced component.</returns>
private object CreateInstance()
{
return Activator.CreateInstance(componentType);
}
@@ -182,8 +179,8 @@ namespace Spring.EnterpriseServices
return Assembly.LoadFrom(componentType.Assembly.CodeBase);
}
#endregion
}
}
#endif // (!NET_1_0)
#endregion
}
}
#endif // !MONO

View File

@@ -18,23 +18,20 @@
#endregion
#if (!NET_1_0 && !MONO)
#if !MONO
#region Imports
using System;
using System.Configuration;
using System.Diagnostics;
using System.EnterpriseServices;
using System.IO;
using System.Reflection;
using System.Xml;
using Spring.Context;
using Spring.Context.Support;
using Spring.Core.IO;
using Spring.Objects.Factory.Config;
using Spring.Util;
using ConfigXmlDocument = Spring.Util.ConfigXmlDocument;
#endregion

View File

@@ -11,17 +11,3 @@ using System.Web.UI;
[assembly: AllowPartiallyTrustedCallers]
[assembly: SecurityCritical]
#endif
#if NET_1_0 || NET_1_1
namespace System.Security
{
///<summary>
///</summary>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Method)]
internal class SecurityCriticalAttribute : Attribute
{ }
[AttributeUsage(AttributeTargets.Method)]
internal class SecurityTreatAsSafeAttribute : Attribute
{ }
}
#endif

View File

@@ -323,15 +323,7 @@ namespace Spring.Context.Support
{
s_weblog.Error(string.Format("failed creating context '{0}', Stacktrace:\n{1}", contextName, new StackTrace()), ex);
}
#if NET_1_1
if (ConfigurationUtils.IsConfigurationException(ex))
{
if (ex.InnerException != null)
{
throw ex.InnerException;
}
}
#endif
throw;
}
}

View File

@@ -139,11 +139,7 @@ namespace Spring.Context.Support
{
if (modules[moduleKey] is SessionStateModule)
{
#if !NET_1_1
HookSessionEvent((SessionStateModule)modules[moduleKey]);
#else
HookSessionEvent11();
#endif
}
}
}
@@ -315,7 +311,6 @@ namespace Spring.Context.Support
}
}
#if !NET_1_1
private static void HookSessionEvent(SessionStateModule sessionStateModule)
{
// Hook only into InProcState - all others ignore SessionEnd anyway
@@ -362,58 +357,6 @@ namespace Spring.Context.Support
, CultureInfo.InvariantCulture
);
}
#else
private static Type t_SessionDictionary;
private static void HookSessionEvent11()
{
// Hook only into InProcState - all others ignore SessionEnd anyway
t_SessionDictionary = typeof(HttpSessionState).Assembly.GetType("System.Web.SessionState.SessionDictionary");
Type t_InProcStateClientManager =
typeof(HttpSessionState).Assembly.GetType("System.Web.SessionState.InProcStateClientManager");
TypeRegistry.RegisterType( "InProcStateClientManager", t_InProcStateClientManager );
CacheItemRemovedCallback circ = new CacheItemRemovedCallback( OnCacheItemRemoved );
CACHEKEYPREFIXLENGTH = (int)ExpressionEvaluator.GetValue(null, "InProcStateClientManager.CACHEKEYPREFIXLENGTH");
s_originalCallback = (CacheItemRemovedCallback)ExpressionEvaluator.GetValue(null, "InProcStateClientManager.s_callback");
ExpressionEvaluator.SetValue(null, "InProcStateClientManager.s_callback", circ);
}
private static HttpSessionState CreateSessionState(string key, object state1)
{
string id = key.Substring(CACHEKEYPREFIXLENGTH);
object dict = ExpressionEvaluator.GetValue(state1, "dict");
if (dict == null)
{
dict = Activator.CreateInstance(t_SessionDictionary, true);
}
object staticObjects = ExpressionEvaluator.GetValue(state1, "staticObjects");
int timeout = (int)ExpressionEvaluator.GetValue(state1, "timeout");
bool isCookieless = (bool)ExpressionEvaluator.GetValue(state1, "isCookieless");
HttpSessionState state2 = (HttpSessionState)Activator.CreateInstance(
typeof(HttpSessionState)
, BindingFlags.Instance|BindingFlags.NonPublic
, null
, new object[]
{
id,
dict,
staticObjects,
timeout,
false,
isCookieless,
SessionStateMode.InProc,
true
}
, CultureInfo.InvariantCulture
);
return state2;
}
#endif
#endregion Session Handling Stuff
}
}

View File

@@ -18,16 +18,8 @@
#endregion
#if !NET_1_1
using System.Web.Compilation;
#endif
#if NET_1_1
using System.Reflection;
using System.Web.UI;
#endif
using System;
using System.IO;
//using System.Web;
using Common.Logging;
using Spring.Util;
using IHttpHandler = System.Web.IHttpHandler;
@@ -45,18 +37,6 @@ namespace Spring.Objects.Factory.Support
// CLOVER:OFF
#if NET_1_1
// Required method for resolving control types
private static MethodInfo miGetCompiledUserControlType = null;
static WebObjectUtils()
{
Type tUserControlParser = typeof(System.Web.UI.UserControl).Assembly.GetType("System.Web.UI.UserControlParser");
miGetCompiledUserControlType =
tUserControlParser.GetMethod("GetCompiledUserControlType", BindingFlags.Static | BindingFlags.NonPublic);
}
#endif
/// <summary>
/// Creates a new instance of the <see cref="Spring.Util.WebUtils"/> class.
/// </summary>

View File

@@ -24,12 +24,10 @@ using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.Reflection;
using System.Web;
using System.Web.Caching;
using System.Web.Compilation;
using System.Web.SessionState;
using System.Web.UI;
using Common.Logging;
#endregion
@@ -236,16 +234,6 @@ namespace Spring.Util
private static readonly ILog log = LogManager.GetLogger(typeof (HttpRuntimeEnvironment));
#if NET_1_1
// Required method for resolving control types
private static MethodInfo miGetCompiledUserControlType = null;
static HttpRuntimeEnvironment()
{
Type tUserControlParser = typeof(System.Web.UI.UserControl).Assembly.GetType("System.Web.UI.UserControlParser");
miGetCompiledUserControlType = tUserControlParser.GetMethod("GetCompiledUserControlType", BindingFlags.Static | BindingFlags.NonPublic);
}
#endif
private class RewriteContext : IDisposable
{
private string originalPath;
@@ -269,11 +257,8 @@ namespace Spring.Util
{
originalPath = ctx.Request.Url.PathAndQuery;
string newPath = newVirtualPath + "currentcontext.dummy";
#if NET_1_1
ctx.RewritePath(newPath);
#else
ctx.RewritePath(newPath, rebaseClientPath);
#endif
#region Instrumentation
@@ -294,11 +279,8 @@ namespace Spring.Util
{
log.Debug("restoring path from " + ctx.Request.FilePath + " back to " + originalPath);
}
#if NET_1_1
ctx.RewritePath(originalPath);
#else
ctx.RewritePath(originalPath, rebaseClientPath);
#endif
}
}
}
@@ -340,9 +322,7 @@ namespace Spring.Util
{
return ctx.Request.MapPath(virtualPath);
}
#if NET_1_1
throw new ArgumentException("can't map context relative path outside a context");
#else
if (VirtualPathUtility.IsAbsolute(virtualPath) && virtualPath.StartsWith(HttpRuntime.AppDomainAppVirtualPath))
{
virtualPath = VirtualPathUtility.ToAppRelative(virtualPath);
@@ -354,7 +334,6 @@ namespace Spring.Util
return physicalPath;
}
return virtualPath;
#endif
}
public IDisposable RewritePath(string virtualDirectory, bool rebaseClientPath)
@@ -381,33 +360,15 @@ namespace Spring.Util
{
string rootedVPath = WebUtils.CombineVirtualPaths(CurrentExecutionFilePath, virtualPath);
Type type = null;
#if NET_1_1
if (virtualPath.EndsWith(".aspx"))
{
type = CreateInstanceFromVirtualPath(virtualPath, typeof(Page)).GetType();
}
else if (virtualPath.EndsWith(".ascx"))
{
type = (Type)miGetCompiledUserControlType.Invoke(null, new object[] { rootedVPath, null, HttpContext.Current });
}
#else
type = BuildManager.GetCompiledType(rootedVPath); // requires rooted virtual path!
#endif
Type type = BuildManager.GetCompiledType(rootedVPath);
return type;
}
public object CreateInstanceFromVirtualPath(string virtualPath, Type requiredBaseType)
{
string rootedVPath = WebUtils.CombineVirtualPaths(CurrentExecutionFilePath, virtualPath);
object result;
#if NET_1_1
HttpContext ctx = HttpContext.Current;
string physicalPath = ctx.Server.MapPath(rootedVPath);
result = PageParser.GetCompiledPageInstance(virtualPath, physicalPath, ctx);
#else
result = BuildManager.CreateInstanceFromVirtualPath(rootedVPath, requiredBaseType);
#endif
object result = BuildManager.CreateInstanceFromVirtualPath(rootedVPath, requiredBaseType);
if (!requiredBaseType.IsAssignableFrom(result.GetType()))
{
throw new HttpException(string.Format("Type '{0}' from virtual path '{1}' does not inherit from '{2}'", result.GetType(), rootedVPath, requiredBaseType));

View File

@@ -71,19 +71,8 @@ namespace Spring.Web.UI.Controls
if (!Visible) return;
//log.Debug(string.Format("OnPreRender Content['{0}']", this.contentPlaceHolderID));
#if NET_1_1
Control ctlRoot = this.Page;
if (ctlRoot is Spring.Web.UI.Page)
{
MasterPage masterPage = ((Spring.Web.UI.Page) ctlRoot).Master;
if (masterPage != null)
{
ctlRoot = masterPage;
}
}
#else
Control ctlRoot = (this.Page.Master != null) ? (Control)this.Page.Master : (Control)this.Page;
#endif
Control ctl = ctlRoot.FindControl(this.contentPlaceHolderID);
if (ctl != null)
{

View File

@@ -50,11 +50,7 @@ namespace Spring.Web.UI.Controls
[PersistChildren(true),
ToolboxData("<{0}:DataBindingPanel runat=\"server\" Width=\"125px\" Height=\"50px\"> </{0}:DataBindingPanel>"),
ParseChildren(false),
#if NET_1_1
Designer("System.Web.UI.Design.WebControls.PanelDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
#else
Designer("System.Web.UI.Design.WebControls.PanelContainerDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
#endif
AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class DataBindingPanel : Panel

View File

@@ -78,11 +78,8 @@ namespace Spring.Web.UI.Controls
/// <param name="writer">The <see langword="HtmlTextWriter"/> object that receives the server control content.</param>
protected override void Render(HtmlTextWriter writer)
{
#if NET_1_1
bool hasIntrinsicHead = false;
#else
bool hasIntrinsicHead = (this.Page.Header != null);
#endif
// don't render begin/end element if we are nested within an ASP.NET <head> control
if (!hasIntrinsicHead)
{

View File

@@ -49,11 +49,7 @@ namespace Spring.Web.UI.Controls
[PersistChildren(true),
ToolboxData("<{0}:Panel runat=\"server\" Width=\"125px\" Height=\"50px\"> </{0}:Panel>"),
ParseChildren(false),
#if NET_1_1
Designer("System.Web.UI.Design.WebControls.PanelDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
#else
Designer("System.Web.UI.Design.WebControls.PanelContainerDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
#endif
AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class Panel : System.Web.UI.WebControls.Panel, ISupportsWebDependencyInjection