Imported Upstream version 4.0.3.13

Former-commit-id: 4f1f69b42e04def9a697c2550b23b9cae645ef29
This commit is contained in:
Xamarin Public Jenkins
2015-07-20 03:39:00 -04:00
parent 4cee7df5e0
commit 2c051c3d51
138 changed files with 3829 additions and 206 deletions

View File

@@ -14,6 +14,7 @@ mobile_SUBDIRS := build class
mobile_static_SUBDIRS := build class
binary_reference_assemblies_SUBDIRS := build class
net_4_5_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
xammac_net_4_5_SUBDIRS := build class
xbuild_12_SUBDIRS := build class tools/xbuild
xbuild_14_SUBDIRS := build class tools/xbuild
@@ -57,6 +58,7 @@ $(_boot_:%=profile-do--monodroid--%): profile-do--monodroid--%:
$(_boot_:%=profile-do--monotouch--%): profile-do--monotouch--%: profile-do--build--%
$(_boot_:%=profile-do--monotouch_runtime--%): profile-do--monotouch_runtime--%: profile-do--build--%
$(_boot_:%=profile-do--xammac--%): profile-do--xammac--%: profile-do--build--%
$(_boot_:%=profile-do--xammac_net_4_5--%): profile-do--xammac_net_4_5--%: profile-do--build--%
$(_boot_:%=profile-do--mobile--%): profile-do--mobile--%: profile-do--build--%
$(_boot_:%=profile-do--mobile_static--%): profile-do--mobile_static--%: profile-do--build--%
$(_boot_:%=profile-do--build--%): profile-do--build--%: profile-do--basic--%

View File

@@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
public const string MonoVersion = "4.0.2.0";
public const string MonoVersion = "4.0.3.0";
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";

View File

@@ -9,7 +9,6 @@ static class AssemblyRef
public const string EcmaPublicKey = "b77a5c561934e089";
public const string MicrosoftPublicKey = "b03f5f7f11d50a3a";
public const string MicrosoftVSDesigner = Consts.AssemblyMicrosoft_VSDesigner;
public const string SystemDesign = Consts.AssemblySystem_Design;
public const string SystemDrawing = Consts.AssemblySystem_Drawing;
public const string SystemWeb = Consts.AssemblySystem_Web;

View File

@@ -18,6 +18,7 @@ net_4_5_SUBDIRS = $(monotouch_SUBDIRS) System.Reflection.Emit.ILGeneration Syste
monodroid_SUBDIRS = $(net_4_5_SUBDIRS)
xammac_SUBDIRS = $(net_4_5_SUBDIRS)
xammac_net_4_5_SUBDIRS = $(net_4_5_SUBDIRS)
PROFILE_SUBDIRS = $(net_4_5_SUBDIRS)

View File

@@ -26,6 +26,7 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TransportSecurityBindingElement))]
#if !MOBILE
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DnsEndpointIdentity))]
#if !XAMMAC_4_5
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageSecurityVersion))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.BasicSecurityProfileVersion))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecureConversationVersion))]
@@ -36,6 +37,7 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.SupportingTokenParameters))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.UserNameSecurityTokenParameters))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.TrustVersion))]
#endif
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.SpnEndpointIdentity))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.UpnEndpointIdentity))]
#endif

View File

@@ -75,6 +75,48 @@ monotouch_runtime_dirs := \
System.XML \
Mono.CSharp
xammac_4_5_dirs := \
corlib \
System \
Mono.Posix \
System.Core \
System.XML \
Mono.Security \
System \
I18N \
System.Numerics \
Mono.Data.Tds \
System.Transactions \
System.EnterpriseServices \
System.Data \
System.Runtime.Serialization \
System.Xml.Linq \
Mono.Data.Sqlite \
System.Runtime.Serialization.Formatters.Soap \
System.ComponentModel.DataAnnotations \
System.IdentityModel \
System.IdentityModel.Selectors \
Mono.Messaging \
System.Configuration.Install \
System.Messaging \
System.Web.Services \
System.Net \
System.ServiceModel \
System.ServiceModel.Web \
System.Json \
System.Data.Services.Client \
System.IO.Compression \
System.IO.Compression.FileSystem \
System.ComponentModel.Composition.4.5 \
System.Windows \
System.Xml.Serialization \
Mono.CSharp \
Microsoft.CSharp \
Mono.CompilerServices.SymbolWriter \
System.Data.Linq \
System.Net.Http \
$(pcl_facade_dirs)
net_4_5_dirs := \
corlib \
System \
@@ -217,6 +259,7 @@ monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
mobile_static_SUBDIRS := $(mobile_static_dirs)
mobile_SUBDIRS := $(mobile_dynamic_dirs)
xammac_SUBDIRS := $(xammac_dirs)
xammac_net_4_5_SUBDIRS := $(xammac_4_5_dirs)
binary_reference_assemblies_SUBDIRS := reference-assemblies
net_4_5_SUBDIRS := $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
@@ -224,7 +267,7 @@ xbuild_14_SUBDIRS := $(xbuild_4_0_dirs)
include ../build/rules.make
SUBDIRS = $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_5_dirs)
SUBDIRS = $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_5_dirs) $(xammac_net_4_5_SUBDIRS)
DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs)

View File

@@ -12,7 +12,7 @@ CLEAN_FILES += $(STRING_MESSAGES)
EXTRA_DISTFILES = \
src/ComponentModel/Strings.resx
VALID_PROFILE := $(filter net_4_5 monotouch monodroid xammac mobile mobile_static, $(PROFILE))
VALID_PROFILE := $(filter net_4_5 monotouch monodroid xammac xammac_net_4_5 mobile mobile_static, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.ComponentModel.Composition.dll
NO_INSTALL = yes

View File

@@ -0,0 +1 @@
#include net_4_5_System.Core.dll.sources

View File

@@ -17,7 +17,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
EXTRA_DISTFILES = src/DbLinq/Schema/Dbml/DbmlSchema.xsd
# This is a .NET 3.5+ assembly
VALID_PROFILE := $(filter net_4_5, $(PROFILE))
VALID_PROFILE := $(filter xammac_net_4_5 net_4_5, $(PROFILE))
ifndef VALID_PROFILE
LIBRARY_NAME = dummy-System.Data.Linq.dll
NO_INSTALL = yes

View File

@@ -17,9 +17,11 @@ LIB_MCS_FLAGS = \
-resource:Client/System.Data.Services.Client.resources \
-warn:2
ifndef NO_WINDOWS_BASE
ifneq (2.1, $(FRAMEWORK_VERSION))
LIB_MCS_FLAGS += -r:WindowsBase
endif
endif
include ../../build/library.make

View File

@@ -0,0 +1 @@
#include net_4_5_System.Data.Services.Client.dll.sources

View File

@@ -8,8 +8,8 @@ LIB_MCS_FLAGS = \
-nowarn:649 \
-unsafe \
-r:System \
-r:System.Xml.dll \
-r:System.Core.dll
-r:System.Xml.dll \
-d:NET_2_0
MOBILE := $(filter monotouch monodroid xammac mobile mobile_static, $(PROFILE))
ifdef MOBILE

View File

@@ -11,11 +11,7 @@ static class Bid
internal static void TraceEx(uint flags, string fmtPrintfW, params object[] args)
{
}
#if !MOBILE
internal static void TraceSqlReturn(string fmtPrintfW, System.Data.Odbc.ODBC32.RetCode a1, string a2)
{
}
#endif
internal static void ScopeEnter(out IntPtr hScp, string fmt, params object[] args) {
hScp = NoData;
}

View File

@@ -0,0 +1,57 @@
using System.Data.SqlClient;
namespace System.Data.Common {
internal static class DbConnectionStringDefaults {
// all
// internal const string NamedConnection = "";
// Odbc
internal const string Driver = "";
internal const string Dsn = "";
// OleDb
internal const bool AdoNetPooler = false;
internal const string FileName = "";
internal const int OleDbServices = ~(/*DBPROPVAL_OS_AGR_AFTERSESSION*/0x00000008 | /*DBPROPVAL_OS_CLIENTCURSOR*/0x00000004); // -13
internal const string Provider = "";
// OracleClient
internal const bool Unicode = false;
internal const bool OmitOracleConnectionName = false;
// SqlClient
internal const ApplicationIntent ApplicationIntent = System.Data.SqlClient.ApplicationIntent.ReadWrite;
internal const string ApplicationName = ".Net SqlClient Data Provider";
internal const bool AsynchronousProcessing = false;
internal const string AttachDBFilename = "";
internal const int ConnectTimeout = 15;
internal const bool ConnectionReset = true;
internal const bool ContextConnection = false;
internal const string CurrentLanguage = "";
internal const string DataSource = "";
internal const bool Encrypt = false;
internal const bool Enlist = true;
internal const string FailoverPartner = "";
internal const string InitialCatalog = "";
internal const bool IntegratedSecurity = false;
internal const int LoadBalanceTimeout = 0; // default of 0 means don't use
internal const bool MultipleActiveResultSets = false;
internal const bool MultiSubnetFailover = false;
internal const int MaxPoolSize = 100;
internal const int MinPoolSize = 0;
internal const string NetworkLibrary = "";
internal const int PacketSize = 8000;
internal const string Password = "";
internal const bool PersistSecurityInfo = false;
internal const bool Pooling = true;
internal const bool TrustServerCertificate = false;
internal const string TypeSystemVersion = "Latest";
internal const string UserID = "";
internal const bool UserInstance = false;
internal const bool Replication = false;
internal const string WorkstationID = "";
internal const string TransactionBinding = "Implicit Unbind";
internal const int ConnectRetryCount = 1;
internal const int ConnectRetryInterval = 10;
}
}

View File

@@ -1,16 +0,0 @@
using System.Text;
using System.Runtime.InteropServices;
namespace System.Data.Odbc {
internal abstract class OdbcHandle : SafeHandle {
protected OdbcHandle(ODBC32.SQL_HANDLE handleType, OdbcHandle parentHandle) : base(IntPtr.Zero, true) {
throw new NotImplementedException ();
}
internal ODBC32.RetCode GetDiagnosticRecord(short record, out string sqlState, StringBuilder message, out int nativeError, out short cchActual) {
throw new NotImplementedException ();
}
}
}

View File

@@ -74,7 +74,7 @@ static class Res
public const string ADP_InvalidDataType = "ADP_InvalidDataType";
public const string ADP_InvalidDateTimeDigits = "ADP_InvalidDateTimeDigits";
public const string ADP_InvalidDestinationBufferIndex = "ADP_InvalidDestinationBufferIndex";
public const string ADP_InvalidEnumerationValue = "The {0} enumeration value, {1}, is invalid.";
public const string ADP_InvalidEnumerationValue = "ADP_InvalidEnumerationValue";
public const string ADP_InvalidFormatValue = "ADP_InvalidFormatValue";
public const string ADP_InvalidImplicitConversion = "ADP_InvalidImplicitConversion";
public const string ADP_InvalidKey = "ADP_InvalidKey";
@@ -99,7 +99,7 @@ static class Res
public const string ADP_InvalidUDL = "ADP_InvalidUDL";
public const string ADP_InvalidValue = "ADP_InvalidValue";
public const string ADP_InvalidXMLBadVersion = "ADP_InvalidXMLBadVersion";
public const string ADP_KeywordNotSupported = "Keyword not supported: '{0}'.";
public const string ADP_KeywordNotSupported = "ADP_KeywordNotSupported";
public const string ADP_LiteralValueIsInvalid = "ADP_LiteralValueIsInvalid";
public const string ADP_LocalTransactionPresent = "ADP_LocalTransactionPresent";
public const string ADP_MismatchedAsyncResult = "ADP_MismatchedAsyncResult";

View File

@@ -1,12 +0,0 @@
using System.ComponentModel;
namespace System.Data
{
sealed class ResCategoryAttribute : CategoryAttribute
{
public ResCategoryAttribute (string category)
: base (category)
{
}
}
}

View File

@@ -0,0 +1,131 @@
//
// System.Data.Common.DataColumnMapping.cs
//
// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
// Tim Coleman (tim@timcoleman.com)
//
// (C) Ximian, Inc
// Copyright (C) Tim Coleman, 2002-2003
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel;
using System.Data;
namespace System.Data.Common {
#if NET_2_0
[TypeConverterAttribute ("System.Data.Common.DataColumnMapping+DataColumnMappingConverter, " + Consts.AssemblySystem_Data)]
#else
[TypeConverterAttribute (typeof (DataColumnMappingConverter))]
#endif
public sealed class DataColumnMapping : MarshalByRefObject, IColumnMapping, ICloneable
{
#region Fields
string sourceColumn;
string dataSetColumn;
#endregion // Fields
#region Constructors
public DataColumnMapping ()
{
sourceColumn = String.Empty;
dataSetColumn = String.Empty;
}
public DataColumnMapping (string sourceColumn, string dataSetColumn)
{
this.sourceColumn = sourceColumn;
this.dataSetColumn = dataSetColumn;
}
#endregion // Constructors
#region Properties
#if ONLY_1_1
[DataSysDescription ("DataColumn.ColumnName")]
#endif
[DefaultValue ("")]
public string DataSetColumn {
get { return dataSetColumn; }
set { dataSetColumn = value; }
}
#if !NET_2_0
[DataSysDescription ("Source column name - case sensitive.")]
#endif
[DefaultValue ("")]
public string SourceColumn {
get { return sourceColumn; }
set { sourceColumn = value; }
}
#endregion // Properties
#region Methods
[EditorBrowsable (EditorBrowsableState.Advanced)]
public DataColumn GetDataColumnBySchemaAction (DataTable dataTable, Type dataType, MissingSchemaAction schemaAction)
{
if (dataTable.Columns.Contains (dataSetColumn))
return dataTable.Columns [dataSetColumn];
if (schemaAction == MissingSchemaAction.Ignore)
return null;
if (schemaAction == MissingSchemaAction.Error)
throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", DataSetColumn, dataTable.TableName, SourceColumn));
return new DataColumn (dataSetColumn, dataType);
}
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
public static DataColumn GetDataColumnBySchemaAction (string sourceColumn, string dataSetColumn, DataTable dataTable, Type dataType, MissingSchemaAction schemaAction)
{
if (dataTable.Columns.Contains (dataSetColumn))
return dataTable.Columns [dataSetColumn];
if (schemaAction == MissingSchemaAction.Ignore)
return null;
if (schemaAction == MissingSchemaAction.Error)
throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", dataSetColumn, dataTable.TableName, sourceColumn));
return new DataColumn (dataSetColumn, dataType);
}
#endif
object ICloneable.Clone ()
{
return new DataColumnMapping (SourceColumn, DataSetColumn);
}
public override string ToString ()
{
return SourceColumn;
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,338 @@
//
// System.Data.Common.DataColumnMappingCollection
//
// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
// Tim Coleman (tim@timcoleman.com)
//
// (C) Ximian, Inc
// Copyright (C) Tim Coleman, 2002-2003
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
namespace System.Data.Common
{
public sealed class DataColumnMappingCollection : MarshalByRefObject, IColumnMappingCollection , IList, ICollection, IEnumerable
{
#region Fields
readonly ArrayList list;
readonly Hashtable sourceColumns;
readonly Hashtable dataSetColumns;
#endregion // Fields
#region Constructors
public DataColumnMappingCollection ()
{
list = new ArrayList ();
sourceColumns = new Hashtable ();
dataSetColumns = new Hashtable ();
}
#endregion // Constructors
#region Properties
[Browsable (false)]
#if !NET_2_0
[DataSysDescription ("The number of items in the collection")]
#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public int Count {
get { return list.Count; }
}
[Browsable (false)]
#if !NET_2_0
[DataSysDescription ("The specified DataColumnMapping object.")]
#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public DataColumnMapping this [int index] {
get { return (DataColumnMapping)(list[index]); }
set {
DataColumnMapping mapping = (DataColumnMapping)(list[index]);
sourceColumns[mapping] = value;
dataSetColumns[mapping] = value;
list[index] = value;
}
}
[Browsable (false)]
#if !NET_2_0
[DataSysDescription ("The specified DataColumnMapping object.")]
#endif
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public DataColumnMapping this [string sourceColumn] {
get {
if (!Contains(sourceColumn))
throw new IndexOutOfRangeException("DataColumnMappingCollection doesn't contain DataColumnMapping with SourceColumn '" + sourceColumn + "'.");
return (DataColumnMapping) sourceColumns [sourceColumn];
}
set {
this [list.IndexOf (sourceColumns [sourceColumn])] = value;
}
}
object ICollection.SyncRoot {
get { return list.SyncRoot; }
}
bool ICollection.IsSynchronized {
get { return list.IsSynchronized; }
}
object IColumnMappingCollection.this [string index] {
get { return this [index]; }
set {
if (!(value is DataColumnMapping))
throw new ArgumentException ();
this [index] = (DataColumnMapping) value;
}
}
object IList.this [int index] {
get { return this [index]; }
set {
if (!(value is DataColumnMapping))
throw new ArgumentException ();
this [index] = (DataColumnMapping) value;
}
}
bool IList.IsReadOnly {
get { return false; }
}
bool IList.IsFixedSize {
get { return false; }
}
#endregion // Properties
#region Methods
public int Add (object value)
{
if (!(value is DataColumnMapping))
throw new InvalidCastException ();
list.Add (value);
sourceColumns [((DataColumnMapping) value).SourceColumn] = value;
dataSetColumns [((DataColumnMapping )value).DataSetColumn] = value;
return list.IndexOf (value);
}
public DataColumnMapping Add (string sourceColumn, string dataSetColumn)
{
DataColumnMapping mapping = new DataColumnMapping (sourceColumn, dataSetColumn);
Add (mapping);
return mapping;
}
#if NET_2_0
public void AddRange (Array values)
{
for (int i = 0; i < values.Length; ++i)
Add (values.GetValue (i));
}
#endif
public void AddRange (DataColumnMapping[] values)
{
foreach (DataColumnMapping mapping in values)
Add (mapping);
}
public void Clear ()
{
list.Clear ();
}
public bool Contains (object value)
{
if (!(value is DataColumnMapping))
throw new InvalidCastException("Object is not of type DataColumnMapping");
return (list.Contains (value));
}
public bool Contains (string value)
{
return (sourceColumns.Contains (value));
}
public void CopyTo (Array array, int index)
{
list.CopyTo (array,index);
}
#if NET_2_0
public void CopyTo (DataColumnMapping [] array, int index)
{
list.CopyTo (array, index);
}
#endif
public DataColumnMapping GetByDataSetColumn (string value)
{
// this should work case-insenstive.
if (!(dataSetColumns [value] == null))
return (DataColumnMapping) (dataSetColumns [value]);
else {
string lowcasevalue = value.ToLower ();
object [] keyarray = new object [dataSetColumns.Count];
dataSetColumns.Keys.CopyTo (keyarray, 0);
for (int i = 0; i < keyarray.Length; i++) {
string temp = (string) keyarray [i];
if (lowcasevalue.Equals (temp.ToLower ()))
return (DataColumnMapping) (dataSetColumns [keyarray [i]]);
}
return null;
}
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
public static DataColumnMapping GetColumnMappingBySchemaAction (DataColumnMappingCollection columnMappings, string sourceColumn, MissingMappingAction mappingAction)
{
if (columnMappings.Contains (sourceColumn))
return columnMappings[sourceColumn];
if (mappingAction == MissingMappingAction.Ignore)
return null;
if (mappingAction == MissingMappingAction.Error)
throw new InvalidOperationException (String.Format ("Missing SourceColumn mapping for '{0}'", sourceColumn));
return new DataColumnMapping (sourceColumn, sourceColumn);
}
#if NET_2_0
[MonoTODO]
[EditorBrowsable (EditorBrowsableState.Advanced)]
public static DataColumn GetDataColumn (DataColumnMappingCollection columnMappings, string sourceColumn, Type dataType, DataTable dataTable, MissingMappingAction mappingAction, MissingSchemaAction schemaAction)
{
throw new NotImplementedException ();
}
#endif
public IEnumerator GetEnumerator ()
{
return list.GetEnumerator ();
}
IColumnMapping IColumnMappingCollection.Add (string sourceColumnName, string dataSetColumnName)
{
return Add (sourceColumnName, dataSetColumnName);
}
IColumnMapping IColumnMappingCollection.GetByDataSetColumn (string dataSetColumnName)
{
return GetByDataSetColumn (dataSetColumnName);
}
public int IndexOf (object value)
{
return list.IndexOf (value);
}
public int IndexOf (string sourceColumn)
{
return list.IndexOf (sourceColumns [sourceColumn]);
}
public int IndexOfDataSetColumn (string dataSetColumn)
{
// this should work case-insensitive
if (!(dataSetColumns [dataSetColumn] == null))
return list.IndexOf (dataSetColumns [dataSetColumn]);
else {
string lowcasevalue = dataSetColumn.ToLower ();
object [] keyarray = new object[dataSetColumns.Count];
dataSetColumns.Keys.CopyTo (keyarray,0);
for (int i = 0; i < keyarray.Length; i++) {
string temp = (string) keyarray [i];
if (lowcasevalue.Equals (temp.ToLower ()))
return list.IndexOf (dataSetColumns [keyarray [i]]);
}
return -1;
}
}
public void Insert (int index, object value)
{
list.Insert (index, value);
sourceColumns [((DataColumnMapping) value).SourceColumn] = value;
dataSetColumns [((DataColumnMapping) value).DataSetColumn] = value;
}
#if NET_2_0
public void Insert (int index, DataColumnMapping value)
{
list.Insert (index, value);
sourceColumns [value.SourceColumn] = value;
dataSetColumns [value.DataSetColumn] = value;
}
#endif
public void Remove (object value)
{
int index = list.IndexOf (value);
sourceColumns.Remove (((DataColumnMapping) value).SourceColumn);
dataSetColumns.Remove (((DataColumnMapping) value).DataSetColumn);
if (index < 0 || index >=list.Count)
throw new ArgumentException("There is no such element in collection.");
list.Remove (value);
}
#if NET_2_0
public void Remove (DataColumnMapping value)
{
int index = list.IndexOf (value);
sourceColumns.Remove (value.SourceColumn);
dataSetColumns.Remove (value.DataSetColumn);
if ( index < 0 || index >=list.Count)
throw new ArgumentException("There is no such element in collection.");
list.Remove (value);
}
#endif
public void RemoveAt (int index)
{
if (index < 0 || index >=list.Count)
throw new IndexOutOfRangeException("There is no element in collection.");
Remove (list [index]);
}
public void RemoveAt (string sourceColumn)
{
RemoveAt (list.IndexOf (sourceColumns [sourceColumn]));
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,59 @@
//
// System.Data.Common.DataColumnMappingConverter.cs
//
// Author:
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2004 Andreas Nahr
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Globalization;
using System.ComponentModel;
namespace System.Data.Common
{
internal sealed class DataColumnMappingConverter : ExpandableObjectConverter
{
[MonoTODO]
public DataColumnMappingConverter ()
{
throw new NotImplementedException ();
}
[MonoTODO]
public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
throw new NotImplementedException ();
}
[MonoTODO]
public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
{
throw new NotImplementedException ();
}
}
}

Some files were not shown because too many files have changed in this diff Show More