You've already forked linux-packaging-mono
Imported Upstream version 4.0.3.13
Former-commit-id: 4f1f69b42e04def9a697c2550b23b9cae645ef29
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include net_4_5_System.Core.dll.sources
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include net_4_5_System.Data.Services.Client.dll.sources
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace System.Data
|
||||
{
|
||||
sealed class ResCategoryAttribute : CategoryAttribute
|
||||
{
|
||||
public ResCategoryAttribute (string category)
|
||||
: base (category)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
131
mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs
Normal file
131
mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
159
mcs/class/System.Data/System.Data.Common/DataTableMapping.cs
Normal file
159
mcs/class/System.Data/System.Data.Common/DataTableMapping.cs
Normal file
@@ -0,0 +1,159 @@
|
||||
//
|
||||
// System.Data.Common.DataTableMapping.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.DataTableMapping+DataTableMappingConverter, " + Consts.AssemblySystem_Data)]
|
||||
#else
|
||||
[TypeConverterAttribute (typeof (DataTableMappingConverter))]
|
||||
#endif
|
||||
public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, ICloneable
|
||||
{
|
||||
#region Fields
|
||||
|
||||
string sourceTable;
|
||||
string dataSetTable;
|
||||
DataColumnMappingCollection columnMappings;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
public DataTableMapping ()
|
||||
{
|
||||
dataSetTable = String.Empty;
|
||||
sourceTable = String.Empty;
|
||||
columnMappings = new DataColumnMappingCollection ();
|
||||
}
|
||||
|
||||
public DataTableMapping (string sourceTable, string dataSetTable)
|
||||
: this ()
|
||||
{
|
||||
this.sourceTable = sourceTable;
|
||||
this.dataSetTable = dataSetTable;
|
||||
}
|
||||
|
||||
public DataTableMapping (string sourceTable, string dataSetTable, DataColumnMapping[] columnMappings)
|
||||
: this (sourceTable, dataSetTable)
|
||||
{
|
||||
this.columnMappings.AddRange (columnMappings);
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
#if !NET_2_0
|
||||
[DataSysDescription ("Individual columns mappings when this table mapping is matched.")]
|
||||
#endif
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
|
||||
public DataColumnMappingCollection ColumnMappings {
|
||||
get { return columnMappings; }
|
||||
}
|
||||
|
||||
#if !NET_2_0
|
||||
[DataSysDescription ("DataTable.TableName")]
|
||||
#endif
|
||||
[DefaultValue ("")]
|
||||
public string DataSetTable {
|
||||
get { return dataSetTable; }
|
||||
set { dataSetTable = value; }
|
||||
}
|
||||
|
||||
IColumnMappingCollection ITableMapping.ColumnMappings {
|
||||
get { return ColumnMappings; }
|
||||
}
|
||||
|
||||
#if !NET_2_0
|
||||
[DataSysDescription ("The DataTableMapping source table name. This name is case sensitive.")]
|
||||
#endif
|
||||
[DefaultValue ("")]
|
||||
public string SourceTable {
|
||||
get { return sourceTable; }
|
||||
set { sourceTable = value; }
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
public DataColumnMapping GetColumnMappingBySchemaAction (string sourceColumn, MissingMappingAction mappingAction)
|
||||
{
|
||||
return DataColumnMappingCollection.GetColumnMappingBySchemaAction (columnMappings, sourceColumn, mappingAction);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
[MonoTODO]
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
public DataColumn GetDataColumn (string sourceColumn,
|
||||
Type dataType,
|
||||
DataTable dataTable,
|
||||
MissingMappingAction mappingAction,
|
||||
MissingSchemaAction schemaAction)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endif
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
public DataTable GetDataTableBySchemaAction (DataSet dataSet, MissingSchemaAction schemaAction)
|
||||
{
|
||||
if (dataSet.Tables.Contains (DataSetTable))
|
||||
return dataSet.Tables [DataSetTable];
|
||||
if (schemaAction == MissingSchemaAction.Ignore)
|
||||
return null;
|
||||
if (schemaAction == MissingSchemaAction.Error)
|
||||
throw new InvalidOperationException (String.Format ("Missing the '{0} DataTable for the '{1}' SourceTable", DataSetTable, SourceTable));
|
||||
return new DataTable (DataSetTable);
|
||||
}
|
||||
|
||||
object ICloneable.Clone ()
|
||||
{
|
||||
DataColumnMapping [] arr = new DataColumnMapping [columnMappings.Count];
|
||||
columnMappings.CopyTo (arr, 0);
|
||||
return new DataTableMapping (SourceTable, DataSetTable, arr);
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return SourceTable;
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
//
|
||||
// System.Data.Common.DataTableMappingCollection.cs
|
||||
//
|
||||
// Author:
|
||||
// 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;
|
||||
|
||||
namespace System.Data.Common
|
||||
{
|
||||
[ListBindable (false)]
|
||||
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DataTableMappingCollectionEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
|
||||
public sealed class DataTableMappingCollection : MarshalByRefObject, ITableMappingCollection, IList, ICollection, IEnumerable
|
||||
{
|
||||
#region Fields
|
||||
|
||||
ArrayList mappings;
|
||||
Hashtable sourceTables;
|
||||
Hashtable dataSetTables;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public DataTableMappingCollection()
|
||||
{
|
||||
mappings = new ArrayList ();
|
||||
sourceTables = new Hashtable ();
|
||||
dataSetTables = 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 mappings.Count; }
|
||||
}
|
||||
|
||||
[Browsable (false)]
|
||||
#if !NET_2_0
|
||||
[DataSysDescription ("The specified DataTableMapping object")]
|
||||
#endif
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
public DataTableMapping this [int index] {
|
||||
get { return (DataTableMapping)(mappings[index]); }
|
||||
set {
|
||||
DataTableMapping mapping = (DataTableMapping) mappings[index];
|
||||
sourceTables [mapping.SourceTable] = value;
|
||||
dataSetTables [mapping.DataSetTable] = value;
|
||||
mappings [index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable (false)]
|
||||
#if !NET_2_0
|
||||
[DataSysDescription ("The specified DataTableMapping object")]
|
||||
#endif
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
public DataTableMapping this [string sourceTable] {
|
||||
get { return (DataTableMapping) sourceTables[sourceTable]; }
|
||||
set { this [mappings.IndexOf (sourceTables[sourceTable])] = value; }
|
||||
}
|
||||
|
||||
object IList.this [int index] {
|
||||
get { return (object)(this[index]); }
|
||||
set {
|
||||
if (!(value is DataTableMapping))
|
||||
throw new ArgumentException ();
|
||||
this[index] = (DataTableMapping)value;
|
||||
}
|
||||
}
|
||||
|
||||
bool ICollection.IsSynchronized {
|
||||
get { return mappings.IsSynchronized; }
|
||||
}
|
||||
|
||||
object ICollection.SyncRoot {
|
||||
get { return mappings.SyncRoot; }
|
||||
}
|
||||
|
||||
bool IList.IsFixedSize {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
bool IList.IsReadOnly {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
object ITableMappingCollection.this [string index] {
|
||||
get { return this [index]; }
|
||||
set {
|
||||
if (!(value is DataTableMapping))
|
||||
throw new ArgumentException ();
|
||||
this [index] = (DataTableMapping) value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
public int Add (object value)
|
||||
{
|
||||
if (!(value is System.Data.Common.DataTableMapping))
|
||||
throw new InvalidCastException ("The object passed in was not a DataTableMapping object.");
|
||||
|
||||
sourceTables [((DataTableMapping) value).SourceTable] = value;
|
||||
dataSetTables [((DataTableMapping) value).DataSetTable] = value;
|
||||
return mappings.Add (value);
|
||||
}
|
||||
|
||||
public DataTableMapping Add (string sourceTable, string dataSetTable)
|
||||
{
|
||||
DataTableMapping mapping = new DataTableMapping (sourceTable, dataSetTable);
|
||||
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 (DataTableMapping[] values)
|
||||
{
|
||||
foreach (DataTableMapping dataTableMapping in values)
|
||||
this.Add (dataTableMapping);
|
||||
}
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
sourceTables.Clear ();
|
||||
dataSetTables.Clear ();
|
||||
mappings.Clear ();
|
||||
}
|
||||
|
||||
public bool Contains (object value)
|
||||
{
|
||||
return mappings.Contains (value);
|
||||
}
|
||||
|
||||
public bool Contains (string value)
|
||||
{
|
||||
return sourceTables.Contains (value);
|
||||
}
|
||||
|
||||
public void CopyTo (Array array, int index)
|
||||
{
|
||||
mappings.CopyTo (array, index);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public void CopyTo (DataTableMapping[] array, int index)
|
||||
{
|
||||
mappings.CopyTo (array, index);
|
||||
}
|
||||
#endif
|
||||
|
||||
public DataTableMapping GetByDataSetTable (string dataSetTable)
|
||||
{
|
||||
// this should work case-insenstive.
|
||||
if (!(dataSetTables[dataSetTable] == null))
|
||||
return (DataTableMapping) (dataSetTables [dataSetTable]);
|
||||
else {
|
||||
string lowcasevalue = dataSetTable.ToLower ();
|
||||
object [] keyarray = new object [dataSetTables.Count];
|
||||
dataSetTables.Keys.CopyTo (keyarray, 0);
|
||||
for (int i=0; i<keyarray.Length; i++) {
|
||||
string temp = (string) keyarray [i];
|
||||
if (lowcasevalue.Equals (temp.ToLower ()))
|
||||
return (DataTableMapping) (dataSetTables [keyarray [i]]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
public static DataTableMapping GetTableMappingBySchemaAction (DataTableMappingCollection tableMappings, string sourceTable, string dataSetTable, MissingMappingAction mappingAction)
|
||||
{
|
||||
if (tableMappings.Contains (sourceTable))
|
||||
return tableMappings[sourceTable];
|
||||
if (mappingAction == MissingMappingAction.Error)
|
||||
throw new InvalidOperationException (String.Format ("Missing source table mapping: '{0}'",
|
||||
sourceTable));
|
||||
if (mappingAction == MissingMappingAction.Ignore)
|
||||
return null;
|
||||
return new DataTableMapping (sourceTable, dataSetTable);
|
||||
}
|
||||
|
||||
public IEnumerator GetEnumerator ()
|
||||
{
|
||||
return mappings.GetEnumerator ();
|
||||
}
|
||||
|
||||
public int IndexOf (object value)
|
||||
{
|
||||
return mappings.IndexOf (value);
|
||||
}
|
||||
|
||||
public int IndexOf (string sourceTable)
|
||||
{
|
||||
return IndexOf (sourceTables[sourceTable]);
|
||||
}
|
||||
|
||||
public int IndexOfDataSetTable (string dataSetTable)
|
||||
{
|
||||
// this should work case-insensitive
|
||||
if (!(dataSetTables[dataSetTable] == null))
|
||||
return IndexOf ((DataTableMapping)(dataSetTables[dataSetTable]));
|
||||
else {
|
||||
string lowcasevalue = dataSetTable.ToLower();
|
||||
object [] keyarray = new object[dataSetTables.Count];
|
||||
dataSetTables.Keys.CopyTo(keyarray,0);
|
||||
for (int i=0; i<keyarray.Length; i++) {
|
||||
string temp = (string) keyarray[i];
|
||||
if (lowcasevalue.Equals(temp.ToLower()))
|
||||
return IndexOf ((DataTableMapping)(dataSetTables[keyarray[i]]));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Insert (int index, object value)
|
||||
{
|
||||
mappings.Insert (index, value);
|
||||
sourceTables [((DataTableMapping) value).SourceTable] = value;
|
||||
dataSetTables [((DataTableMapping) value).DataSetTable] = value;
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public void Insert (int index, DataTableMapping value)
|
||||
{
|
||||
mappings.Insert (index, value);
|
||||
sourceTables [value.SourceTable] = value;
|
||||
dataSetTables [value.DataSetTable] = value;
|
||||
}
|
||||
#endif
|
||||
|
||||
ITableMapping ITableMappingCollection.Add (string sourceTableName, string dataSetTableName)
|
||||
{
|
||||
ITableMapping tableMapping = new DataTableMapping (sourceTableName, dataSetTableName);
|
||||
Add (tableMapping);
|
||||
return tableMapping;
|
||||
}
|
||||
|
||||
ITableMapping ITableMappingCollection.GetByDataSetTable (string dataSetTableName)
|
||||
{
|
||||
return this [mappings.IndexOf (dataSetTables [dataSetTableName])];
|
||||
}
|
||||
|
||||
public void Remove (object value)
|
||||
{
|
||||
if (!(value is DataTableMapping))
|
||||
throw new InvalidCastException ();
|
||||
int index = mappings.IndexOf (value);
|
||||
if (index < 0 || index >= mappings.Count)
|
||||
throw new ArgumentException("There is no such element in collection.");
|
||||
mappings.Remove ((DataTableMapping) value);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public void Remove (DataTableMapping value)
|
||||
{
|
||||
int index = mappings.IndexOf (value);
|
||||
if (index < 0 || index >= mappings.Count)
|
||||
throw new ArgumentException("There is no such element in collection.");
|
||||
mappings.Remove ((DataTableMapping) value);
|
||||
}
|
||||
#endif
|
||||
|
||||
public void RemoveAt (int index)
|
||||
{
|
||||
if (index < 0 || index >= mappings.Count)
|
||||
throw new IndexOutOfRangeException("There is no element in collection.");
|
||||
|
||||
mappings.RemoveAt (index);
|
||||
}
|
||||
|
||||
public void RemoveAt (string sourceTable)
|
||||
{
|
||||
RemoveAt (mappings.IndexOf (sourceTables[sourceTable]));
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// System.Data.Common.DataTableMappingConverter.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 DataTableMappingConverter : ExpandableObjectConverter
|
||||
{
|
||||
[MonoTODO]
|
||||
public DataTableMappingConverter ()
|
||||
{
|
||||
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
Reference in New Issue
Block a user