You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2006/02/01 22:27:16 UTC

svn commit: r374175 - in /ibatis/trunk/cs/mapper: IBatisNet.Common.Logging.Log4Net/ IBatisNet.Common/ IBatisNet.Common/Logging/ IBatisNet.Common/Utilities/ IBatisNet.Common/Utilities/TypesResolver/ IBatisNet.DataMapper/ IBatisNet.DataMapper/Configurati...

Author: gbayon
Date: Wed Feb  1 13:26:08 2006
New Revision: 374175

URL: http://svn.apache.org/viewcvs?rev=374175&view=rev
Log:
- Added fix to depreciated API in .NET V2

Modified:
    ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/IBatisNet.Common.Logging.Log4Net.2005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/Log4NetLoggerFA.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/LogManager.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypesResolver/TypeResolver.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/IBatisNet.Common.Logging.Log4Net.2005.csproj
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/IBatisNet.Common.Logging.Log4Net.2005.csproj?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/IBatisNet.Common.Logging.Log4Net.2005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/IBatisNet.Common.Logging.Log4Net.2005.csproj Wed Feb  1 13:26:08 2006
@@ -79,6 +79,7 @@
     <Reference Include="System">
       <Name>System</Name>
     </Reference>
+    <Reference Include="System.configuration" />
     <Reference Include="System.Data">
       <Name>System.Data</Name>
     </Reference>

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/Log4NetLoggerFA.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/Log4NetLoggerFA.cs?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/Log4NetLoggerFA.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Logging.Log4Net/Log4NetLoggerFA.cs Wed Feb  1 13:26:08 2006
@@ -63,11 +63,23 @@
 
 			if ( configType == "FILE" || configType == "FILE-WATCH" )
 			{
-				if ( configFile == string.Empty )
-					throw new ConfigurationException( "Configration property 'configFile' must be set for log4Net configuration of type 'FILE'."  );
-			
-				if ( !File.Exists( configFile ) )
-					throw new ConfigurationException( "log4net configuration file '" + configFile + "' does not exists" );
+                if (configFile == string.Empty)
+                {
+#if dotnet2
+                    throw new ConfigurationErrorsException("Configration property 'configFile' must be set for log4Net configuration of type 'FILE'.");
+ #else       
+                    throw new ConfigurationException("Configration property 'configFile' must be set for log4Net configuration of type 'FILE'.");
+#endif
+                }
+
+                if (!File.Exists(configFile))
+                {
+#if dotnet2
+                    throw new ConfigurationErrorsException("log4net configuration file '" + configFile + "' does not exists");
+#else       
+                    throw new ConfigurationException("log4net configuration file '" + configFile + "' does not exists");
+#endif
+                }
 			}
 
 			switch ( configType )

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj Wed Feb  1 13:26:08 2006
@@ -72,13 +72,12 @@
     <ErrorReport>prompt</ErrorReport>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Castle.DynamicProxy">
-      <Name>Castle.DynamicProxy</Name>
-      <HintPath>..\External-Bin\Net\1.1\Castle.DynamicProxy.dll</HintPath>
-    </Reference>
-    <Reference Include="System">
-      <Name>System</Name>
+    <Reference Include="Castle.DynamicProxy, Version=1.1.5.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\External-Bin\Net\2.0\Castle.DynamicProxy.dll</HintPath>
     </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.configuration" />
     <Reference Include="System.Data">
       <Name>System.Data</Name>
     </Reference>
@@ -242,4 +241,4 @@
     <PostBuildEvent>
     </PostBuildEvent>
   </PropertyGroup>
-</Project>
+</Project>
\ No newline at end of file

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/ConfigurationSectionHandler.cs Wed Feb  1 13:26:08 2006
@@ -93,8 +93,8 @@
 			}
 			
 			XmlNodeList propertyNodes = logFactoryElement.SelectNodes( ARGUMENT_ELEMENT );
-			
-			NameValueCollection properties = new NameValueCollection( null, new CaseInsensitiveComparer() );
+
+            NameValueCollection properties = new NameValueCollection(StringComparer.InvariantCultureIgnoreCase);
 
 			foreach ( XmlNode propertyNode in propertyNodes )
 			{

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/LogManager.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/LogManager.cs?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/LogManager.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Logging/LogManager.cs Wed Feb  1 13:26:08 2006
@@ -28,6 +28,7 @@
 using System.Collections;
 using System.Collections.Specialized;
 using System.Configuration;
+using System.Xml;
 using IBatisNet.Common.Logging.Impl;
 
 namespace IBatisNet.Common.Logging
@@ -104,7 +105,11 @@
 			LogSetting setting = null;
 			try
 			{
-				setting = (LogSetting)ConfigurationSettings.GetConfig( IBATIS_SECTION_LOGGING );
+#if dotnet2
+                setting = (LogSetting)ConfigurationManager.GetSection(IBATIS_SECTION_LOGGING );
+#else
+ 				setting = (LogSetting)ConfigurationSettings.GetConfig( IBATIS_SECTION_LOGGING );
+#endif
 			}
 			catch ( Exception ex )
 			{
@@ -174,7 +179,7 @@
 		/// <returns></returns>
 		private static ILoggerFactoryAdapter BuildDefaultLoggerFactoryAdapter()
 		{
-			ILoggerFactoryAdapter simpleLogFactory = new ConsoleOutLoggerFA(new NameValueCollection( null, new CaseInsensitiveComparer() ));
+            ILoggerFactoryAdapter simpleLogFactory = new ConsoleOutLoggerFA(new NameValueCollection(StringComparer.InvariantCultureIgnoreCase));
 			return simpleLogFactory;
 		}
 	}

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Resources.cs Wed Feb  1 13:26:08 2006
@@ -404,9 +404,12 @@
 			FileAssemblyInfo fileInfo = new FileAssemblyInfo (resource);
 			if (fileInfo.IsAssemblyQualified)
 			{
-				Assembly assembly = Assembly.LoadWithPartialName (fileInfo.AssemblyName);
-
-				Stream stream = assembly.GetManifestResourceStream(fileInfo.ResourceFileName);
+                #if dotnet2
+                Assembly assembly = Assembly.Load(fileInfo.AssemblyName);
+                #else
+                Assembly assembly = Assembly.LoadWithPartialName (typeInfo.AssemblyName);
+                #endif
+                Stream stream = assembly.GetManifestResourceStream(fileInfo.ResourceFileName);
 				// JIRA - IBATISNET-103 
 				if (stream == null)
 				{

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypesResolver/TypeResolver.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypesResolver/TypeResolver.cs?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypesResolver/TypeResolver.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypesResolver/TypeResolver.cs Wed Feb  1 13:26:08 2006
@@ -43,7 +43,7 @@
 	/// <p>
 	/// The rationale behind the creation of this class is to centralise the
 	/// resolution of type names to <see cref="System.Type"/> instances beyond that
-	/// offered by the plain vanilla <see cref="System.Type.GetType"/> method call.
+	/// offered by the plain vanilla <see cref="System.Type.GetType()"/> method call.
 	/// </p>
 	/// </remarks>
 	/// <version>$Id: TypeResolver.cs,v 1.5 2004/09/28 07:51:47 springboy Exp $</version>
@@ -87,8 +87,12 @@
 			if (typeInfo.IsAssemblyQualified)
 			{
 				// assembly qualified... load the assembly, then the Type
-				Assembly assembly = Assembly.LoadWithPartialName (typeInfo.AssemblyName);
-				if (assembly != null)
+                #if dotnet2
+                Assembly assembly = Assembly.Load(typeInfo.AssemblyName);
+                #else
+                Assembly assembly = Assembly.LoadWithPartialName (typeInfo.AssemblyName);
+                #endif
+                if (assembly != null)
 				{
 					type = assembly.GetType (typeInfo.TypeName, true, true);
 				}

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs Wed Feb  1 13:26:08 2006
@@ -30,8 +30,8 @@
 using System.Collections;
 using System.Collections.Specialized;
 using System.IO;
-using System.Reflection;
 using System.Text;
+using System.Reflection;
 using System.Threading;
 using System.Xml;
 using System.Xml.Schema;
@@ -539,16 +539,17 @@
 		/// <param name="schemaFileName">schema File Name</param>
 		private void ValidateSchema( XmlNode section, string schemaFileName )
 		{
-			XmlValidatingReader validatingReader = null;
-			Stream xsdFile = null; 
+#if dotnet2
+            XmlReader validatingReader = null;
+#else
+            XmlValidatingReader validatingReader = null;
+#endif
+            Stream xsdFile = null; 
 
 			_configScope.ErrorContext.Activity = "Validate SqlMap config";
 			try
-			{
-				//Validate the document using a schema
-				validatingReader = new XmlValidatingReader( new XmlTextReader( new StringReader( section.OuterXml ) ) );
-				validatingReader.ValidationType = ValidationType.Schema;
-
+			{               
+				//Validate the document using a schema               
 				xsdFile = GetStream( schemaFileName ); 
 
 				if (xsdFile == null)
@@ -557,15 +558,33 @@
 					throw new ConfigurationException( "Unable to locate embedded resource [IBatisNet.DataMapper."+schemaFileName+"]. If you are building from source, verfiy the file is marked as an embedded resource.");
 				}
 				
-				XmlSchema xmlSchema = XmlSchema.Read( xsdFile, new ValidationEventHandler(ValidationCallBack) );
+				XmlSchema schema = XmlSchema.Read( xsdFile, new ValidationEventHandler(ValidationCallBack) );
+
+#if dotnet2
+                XmlReaderSettings settings = new XmlReaderSettings();
+                settings.ValidationType = ValidationType.Schema;
+
+                // Create the XmlSchemaSet class.
+                XmlSchemaSet schemas = new XmlSchemaSet();
+                schemas.Add(schema);
 
-				validatingReader.Schemas.Add(xmlSchema);
+                settings.Schemas = schemas;
+                validatingReader = XmlReader.Create( new XmlNodeReader(section) ,  settings);
 
 				// Wire up the call back.  The ValidationEvent is fired when the
 				// XmlValidatingReader hits an issue validating a section of the xml
-				validatingReader.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
-
-				// Validate the document
+                settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
+#else
+                validatingReader = new XmlValidatingReader(new XmlTextReader(new StringReader(section.OuterXml)));
+                validatingReader.ValidationType = ValidationType.Schema;
+
+                validatingReader.Schemas.Add(xmlSchema);
+
+                // Wire up the call back.  The ValidationEvent is fired when the
+                // XmlValidatingReader hits an issue validating a section of the xml
+                validatingReader.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
+#endif
+                // Validate the document
 				while (validatingReader.Read()){}
 
 				if(! _configScope.IsXmlValid )

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj Wed Feb  1 13:26:08 2006
@@ -79,6 +79,7 @@
     <Reference Include="System">
       <Name>System</Name>
     </Reference>
+    <Reference Include="System.configuration" />
     <Reference Include="System.Data">
       <Name>System.Data</Name>
     </Reference>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs Wed Feb  1 13:26:08 2006
@@ -297,8 +297,12 @@
 					} 
 					catch (Exception e) 
 					{
-						throw new ConfigurationException("Error. Could not set TypeHandler.  Cause: " + e.Message, e);
-					}
+#if dotnet2
+                        throw new ConfigurationErrorsException("Error. Could not set TypeHandler.  Cause: " + e.Message, e);
+#else       
+                       throw new ConfigurationException("Error. Could not set TypeHandler.  Cause: " + e.Message, e);
+#endif
+                    }
 				}
 			}
 			else if (this.TypeHandlerFactory.GetTypeHandler(clazz, dbType) != null) 
@@ -323,7 +327,11 @@
 					} 
 					catch (Exception e) 
 					{
-						throw new ConfigurationException("Error. Could not set TypeHandler.  Cause: " + e.Message, e);
+#if dotnet2
+                        throw new ConfigurationErrorsException("Error. Could not set TypeHandler.  Cause: " + e.Message, e);
+#else       
+                       throw new ConfigurationException("Error. Could not set TypeHandler.  Cause: " + e.Message, e);
+#endif
 					}
 				}
 			}

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs?rev=374175&r1=374174&r2=374175&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs Wed Feb  1 13:26:08 2006
@@ -981,7 +981,7 @@
 		}
 		
 		#endregion
-
+        
         #region QueryForList .NET 2.0
         #if dotnet2
         /// <summary>