From a5b985c755c9952960d5e674cf6505c0eedc91b7 Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Wed, 18 Mar 2015 15:58:38 +0800 Subject: [PATCH] Add #if-s for mobile builds. --- .../System/Data/Common/AdapterUtil.cs | 8 +++-- .../System/Data/Common/NativeMethods.cs | 2 ++ .../System/Data/Common/System.Data_BID.cs | 6 ++-- .../System/Data/Common/UnsafeNativeMethods.cs | 6 ++++ .../System.Data/System/Data/DataSet.cs | 6 ++++ .../Data/ProviderBase/DbConnectionFactory.cs | 20 ++++++++++++ .../Data/ProviderBase/DbConnectionHelper.cs | 2 ++ .../Data/ProviderBase/DbConnectionInternal.cs | 14 ++++++++ .../Data/ProviderBase/DbConnectionPool.cs | 32 +++++++++++++++++-- .../ProviderBase/DbConnectionPoolGroup.cs | 6 ++++ .../System/Data/SQLTypes/SQLFileStream.cs | 4 +++ .../System/Data/SqlClient/LocalDBAPI.cs | 2 ++ .../System/Data/SqlClient/SqlConnection.cs | 2 ++ .../Data/SqlClient/SqlConnectionFactory.cs | 6 +++- .../Data/SqlClient/TdsParserStaticMethods.cs | 2 ++ 15 files changed, 111 insertions(+), 7 deletions(-) diff --git a/mcs/class/referencesource/System.Data/System/Data/Common/AdapterUtil.cs b/mcs/class/referencesource/System.Data/System/Data/Common/AdapterUtil.cs index 71092075d22..bdd182d7442 100644 --- a/mcs/class/referencesource/System.Data/System/Data/Common/AdapterUtil.cs +++ b/mcs/class/referencesource/System.Data/System/Data/Common/AdapterUtil.cs @@ -18,8 +18,8 @@ namespace System.Data.Common { using System.Data.ProviderBase; #if !MOBILE using System.Data.Odbc; -#endif using System.Data.OleDb; +#endif using System.Data.Sql; using System.Data.SqlTypes; using System.Diagnostics; @@ -2111,7 +2111,11 @@ namespace System.Data.Common { FileIOPermission.RevertAssert(); } } -#if !MOBILE +#if MOBILE + static internal object LocalMachineRegistryValue(string subkey, string queryvalue) { + return null; + } +#else [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] static internal Stream GetXmlStreamFromValues(String[] values, String errorString) { diff --git a/mcs/class/referencesource/System.Data/System/Data/Common/NativeMethods.cs b/mcs/class/referencesource/System.Data/System/Data/Common/NativeMethods.cs index ba5eb1fc220..ebcf3fc72e4 100644 --- a/mcs/class/referencesource/System.Data/System/Data/Common/NativeMethods.cs +++ b/mcs/class/referencesource/System.Data/System/Data/Common/NativeMethods.cs @@ -15,6 +15,7 @@ namespace System.Data.Common { internal static class NativeMethods { +#if !NO_OLEDB [Guid("0c733a1e-2a1c-11ce-ade5-00aa0044773d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport] internal interface ISourcesRowset { @@ -25,6 +26,7 @@ namespace System.Data.Common { [In] IntPtr rgProperties, [Out, MarshalAs(UnmanagedType.Interface)] out object ppRowset); } +#endif [Guid("0C733A5E-2A1C-11CE-ADE5-00AA0044773D"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown), ComImport] internal interface ITransactionJoin { diff --git a/mcs/class/referencesource/System.Data/System/Data/Common/System.Data_BID.cs b/mcs/class/referencesource/System.Data/System/Data/Common/System.Data_BID.cs index 8cff81a5dc6..c95844c82a8 100644 --- a/mcs/class/referencesource/System.Data/System/Data/Common/System.Data_BID.cs +++ b/mcs/class/referencesource/System.Data/System/Data/Common/System.Data_BID.cs @@ -290,7 +290,7 @@ internal static partial class Bid } } - +#if !NO_ODBC // // Manually edited wrappers // @@ -311,7 +311,9 @@ internal static partial class Bid if (((System.Data.Odbc.ODBC32.RetCode.SUCCESS != a1) || (modFlags & ApiGroup.StatusOk) != 0) && (modFlags & ApiGroup.Trace) != 0 && modID != NoData) NativeMethods.Trace (modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, (int)(short)a1, a2); } +#endif +#if !NO_OLEDB [BidMethod] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static void Trace(string fmtPrintfW, System.Data.OleDb.OleDbHResult a1) { // @@ -336,7 +338,7 @@ internal static partial class Bid if ((modFlags & ApiGroup.Trace) != 0 && modID != NoData) NativeMethods.Trace (modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, (int)a1,a2); } - +#endif [BidMethod] internal static void Trace(string fmtPrintfW, System.String a1, System.String a2) { diff --git a/mcs/class/referencesource/System.Data/System/Data/Common/UnsafeNativeMethods.cs b/mcs/class/referencesource/System.Data/System/Data/Common/UnsafeNativeMethods.cs index 47a1abb70c8..0c368cfcabe 100644 --- a/mcs/class/referencesource/System.Data/System/Data/Common/UnsafeNativeMethods.cs +++ b/mcs/class/referencesource/System.Data/System/Data/Common/UnsafeNativeMethods.cs @@ -8,7 +8,9 @@ //------------------------------------------------------------------------------ using System; +#if !NO_ODBC using System.Data.Odbc; +#endif using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; @@ -22,6 +24,7 @@ namespace System.Data.Common { [SuppressUnmanagedCodeSecurityAttribute()] internal static class UnsafeNativeMethods { +#if !NO_ODBC // // ODBC32 // @@ -462,7 +465,9 @@ namespace System.Data.Common { [In, MarshalAs(UnmanagedType.LPWStr)] /*SQLCHAR* */string TableType, /*SQLSMALLINT*/Int16 NameLen4); +#endif +#if !NO_OLEDB // // Oleaut32 // @@ -1222,6 +1227,7 @@ namespace System.Data.Common { IntPtr pUnkOuter, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] ref object ppCommand); +#endif // // Advapi32.dll Integrated security functions diff --git a/mcs/class/referencesource/System.Data/System/Data/DataSet.cs b/mcs/class/referencesource/System.Data/System/Data/DataSet.cs index 504cdd268bb..cb0c072a659 100644 --- a/mcs/class/referencesource/System.Data/System/Data/DataSet.cs +++ b/mcs/class/referencesource/System.Data/System/Data/DataSet.cs @@ -19,7 +19,9 @@ namespace System.Data { using System.Collections.Specialized; using System.Xml; using System.Xml.Serialization; +#if !NO_CONFIGURATION using System.Xml.Serialization.Advanced; +#endif using System.Xml.Schema; using System.Runtime.Serialization.Formatters.Binary; //Binary Formatter using System.CodeDom; @@ -3309,6 +3311,7 @@ namespace System.Data { private static bool PublishLegacyWSDL() { Single version = 1.0f; // Default is Version 1.0 +#if !NO_CONFIGURATION NameValueCollection settings = (NameValueCollection)PrivilegedConfigurationManager.GetSection(Keywords.WS_DATASETFULLQNAME); if (settings != null) { @@ -3318,6 +3321,7 @@ namespace System.Data { version = Single.Parse(values[0], CultureInfo.InvariantCulture); } } +#endif return (version < 2.0f); // if config does not exist, Default is Version 1.0 } @@ -3458,6 +3462,7 @@ namespace System.Data { } +#if !NO_CODEDOM public class DataSetSchemaImporterExtension : SchemaImporterExtension { // DataSetSchemaImporterExtension is used for WebServices, it is used to recognize the schema of DataSet within wsdl // If a non 2.0 enabled DataSetSchemaImporterExtension, wsdl will generate a classes that you can't cast to dataset / datatable @@ -3664,4 +3669,5 @@ namespace System.Data { return false; } } +#endif } diff --git a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionFactory.cs b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionFactory.cs index c9fe482c8b6..6832381eb7c 100644 --- a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionFactory.cs +++ b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionFactory.cs @@ -131,7 +131,9 @@ namespace System.Data.ProviderBase { DbConnectionInternal newConnection = CreateConnection(connectionOptions, poolKey, poolGroupProviderInfo, null, owningConnection, userOptions); if (null != newConnection) { +#if !MOBILE PerformanceCounters.HardConnectsPerSecond.Increment(); +#endif newConnection.MakeNonPooledObject(owningConnection, PerformanceCounters); } Bid.Trace(" %d#, Non-pooled database connection created.\n", ObjectID); @@ -144,7 +146,9 @@ namespace System.Data.ProviderBase { DbConnectionInternal newConnection = CreateConnection(options, poolKey, poolGroupProviderInfo, pool, owningObject, userOptions); if (null != newConnection) { +#if !MOBILE PerformanceCounters.HardConnectsPerSecond.Increment(); +#endif newConnection.MakePooledConnection(pool); } Bid.Trace(" %d#, Pooled database connection created.\n", ObjectID); @@ -277,7 +281,9 @@ namespace System.Data.ProviderBase { } else { if (retry.TrySetResult(task.Result)) { +#if !MOBILE PerformanceCounters.NumberOfNonPooledConnections.Increment(); +#endif } else { // The outer TaskCompletionSource was already completed @@ -293,7 +299,9 @@ namespace System.Data.ProviderBase { } connection = CreateNonPooledConnection(owningConnection, poolGroup, userOptions); +#if !MOBILE PerformanceCounters.NumberOfNonPooledConnections.Increment(); +#endif } else { if (owningConnection.ForceNewConnection) { @@ -425,7 +433,9 @@ namespace System.Data.ProviderBase { // lock prevents race condition with PruneConnectionPoolGroups newConnectionPoolGroups.Add(key, newConnectionPoolGroup); +#if !MOBILE PerformanceCounters.NumberOfActiveConnectionPoolGroups.Increment(); +#endif connectionPoolGroup = newConnectionPoolGroup; _connectionPoolGroups = newConnectionPoolGroups; } @@ -483,7 +493,9 @@ namespace System.Data.ProviderBase { if (Bid.AdvancedOn) { Bid.Trace(" %d#, ReleasePool=%d#\n", ObjectID, pool.ObjectID); } +#if !MOBILE PerformanceCounters.NumberOfInactiveConnectionPools.Decrement(); +#endif } } } @@ -505,7 +517,9 @@ namespace System.Data.ProviderBase { if (Bid.AdvancedOn) { Bid.Trace(" %d#, ReleasePoolGroup=%d#\n", ObjectID, poolGroup.ObjectID); } +#if !MOBILE PerformanceCounters.NumberOfInactiveConnectionPoolGroups.Decrement(); +#endif } } } @@ -527,7 +541,9 @@ namespace System.Data.ProviderBase { // move idle entries from last prune pass to a queue for pending release // otherwise process entry which may move it from active to idle if (entry.Value.Prune()) { // may add entries to _poolsToRelease +#if !MOBILE PerformanceCounters.NumberOfActiveConnectionPoolGroups.Decrement(); +#endif QueuePoolGroupForRelease(entry.Value); } else { @@ -556,7 +572,9 @@ namespace System.Data.ProviderBase { } _poolsToRelease.Add(pool); } +#if !MOBILE PerformanceCounters.NumberOfInactiveConnectionPools.Increment(); +#endif } internal void QueuePoolGroupForRelease(DbConnectionPoolGroup poolGroup) { @@ -566,7 +584,9 @@ namespace System.Data.ProviderBase { lock (_poolGroupsToRelease) { _poolGroupsToRelease.Add(poolGroup); } +#if !MOBILE PerformanceCounters.NumberOfInactiveConnectionPoolGroups.Increment(); +#endif } virtual protected DbConnectionInternal CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) { diff --git a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionHelper.cs b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionHelper.cs index 0e562288294..8c09bbc4c08 100644 --- a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionHelper.cs +++ b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionHelper.cs @@ -207,6 +207,7 @@ namespace NAMESPACE { partial void RepairInnerConnection(); +#if !MOBILE // NOTE: This is just a private helper because OracleClient V1.1 shipped // with a different argument name and it's a breaking change to not use // the same argument names in V2.0 (VB Named Parameter Binding--Ick) @@ -235,6 +236,7 @@ namespace NAMESPACE { // we should consider a GC.KeepAlive(this) here. GC.KeepAlive(this); } +#endif override public void EnlistTransaction(SysTx.Transaction transaction) { CONNECTIONOBJECTNAME.ExecutePermission.Demand(); diff --git a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionInternal.cs b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionInternal.cs index 73541107c73..96a6729dd25 100644 --- a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionInternal.cs +++ b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionInternal.cs @@ -356,7 +356,9 @@ namespace System.Data.ProviderBase { Activate(transaction); +#if !MOBILE PerformanceCounters.NumberOfActiveConnections.Increment(); +#endif } internal void AddWeakReference(object value, int tag) { @@ -448,7 +450,9 @@ namespace System.Data.ProviderBase { else { Deactivate(); // ensure we de-activate non-pooled connections, or the data readers and transactions may not get cleaned up... +#if !MOBILE PerformanceCounters.HardDisconnectsPerSecond.Increment(); +#endif // To prevent an endless recursion, we need to clear // the owning object before we call dispose so that @@ -463,7 +467,9 @@ namespace System.Data.ProviderBase { SetInStasis(); } else { +#if !MOBILE PerformanceCounters.NumberOfNonPooledConnections.Decrement(); +#endif if (this.GetType() != typeof(System.Data.SqlClient.SqlInternalConnectionSmi)) { Dispose(); @@ -513,9 +519,11 @@ namespace System.Data.ProviderBase { Debug.Assert(0 == activateCount, "activated multiple times?"); #endif // DEBUG +#if !MOBILE if (PerformanceCounters != null) { // Pool.Clear will DestroyObject that will clean performanceCounters before going here PerformanceCounters.NumberOfActiveConnections.Decrement(); } +#endif if (!_connectionIsDoomed && Pool.UseLoadBalancing) { // If we're not already doomed, check the connection's lifetime and @@ -569,7 +577,9 @@ namespace System.Data.ProviderBase { // once and for all, or the server will have fits about us // leaving connections open until the client-side GC kicks // in. +#if !MOBILE PerformanceCounters.NumberOfNonPooledConnections.Decrement(); +#endif Dispose(); } // When _pooledCount is 0, the connection is a pooled connection @@ -839,7 +849,9 @@ namespace System.Data.ProviderBase { internal void SetInStasis() { _isInStasis = true; Bid.PoolerTrace(" %d#, Non-Pooled Connection has Delegated Transaction, waiting to Dispose.\n", ObjectID); +#if !MOBILE PerformanceCounters.NumberOfStasisConnections.Increment(); +#endif } private void TerminateStasis(bool returningToPool) { @@ -849,7 +861,9 @@ namespace System.Data.ProviderBase { else { Bid.PoolerTrace(" %d#, Delegated Transaction has ended, connection is closed/leaked. Disposing.\n", ObjectID); } +#if !MOBILE PerformanceCounters.NumberOfStasisConnections.Decrement(); +#endif _isInStasis = false; } diff --git a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPool.cs b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPool.cs index a5b05119969..50ef20b0f8e 100644 --- a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPool.cs +++ b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPool.cs @@ -235,8 +235,9 @@ namespace System.Data.ProviderBase { Bid.PoolerTrace(" %d#, Transaction %d#, Connection %d#, Added.\n", ObjectID, transaction.GetHashCode(), transactedObject.ObjectID ); } +#if !MOBILE Pool.PerformanceCounters.NumberOfFreeConnections.Increment(); - +#endif } internal void TransactionEnded(SysTx.Transaction transaction, DbConnectionInternal transactedObject) @@ -300,7 +301,9 @@ namespace System.Data.ProviderBase { // connections, we'll put it back... if (0 <= entry) { +#if !MOBILE Pool.PerformanceCounters.NumberOfFreeConnections.Decrement(); +#endif Pool.PutObjectFromTransactedPool(transactedObject); } } @@ -622,7 +625,9 @@ namespace System.Data.ProviderBase { if (_stackOld.TryPop(out obj)) { Debug.Assert(obj != null, "null connection is not expected"); // If we obtained one from the old stack, destroy it. +#if !MOBILE PerformanceCounters.NumberOfFreeConnections.Decrement(); +#endif // Transaction roots must survive even aging out (TxEnd event will clean them up). bool shouldDestroy = true; @@ -709,12 +714,16 @@ namespace System.Data.ProviderBase { // Second, dispose of all the free connections. while (_stackNew.TryPop(out obj)) { Debug.Assert(obj != null, "null connection is not expected"); +#if !MOBILE PerformanceCounters.NumberOfFreeConnections.Decrement(); +#endif DestroyObject(obj); } while (_stackOld.TryPop(out obj)) { Debug.Assert(obj != null, "null connection is not expected"); +#if !MOBILE PerformanceCounters.NumberOfFreeConnections.Decrement(); +#endif DestroyObject(obj); } @@ -748,7 +757,9 @@ namespace System.Data.ProviderBase { } _objectList.Add(newObj); _totalObjects = _objectList.Count; +#if !MOBILE PerformanceCounters.NumberOfPooledConnections.Increment(); // +#endif } // If the old connection belonged to another pool, we need to remove it from that @@ -964,12 +975,16 @@ namespace System.Data.ProviderBase { if (removed) { Bid.PoolerTrace(" %d#, Connection %d#, Removed from pool.\n", ObjectID, obj.ObjectID); +#if !MOBILE PerformanceCounters.NumberOfPooledConnections.Decrement(); +#endif } obj.Dispose(); Bid.PoolerTrace(" %d#, Connection %d#, Disposed.\n", ObjectID, obj.ObjectID); +#if !MOBILE PerformanceCounters.HardDisconnectsPerSecond.Increment(); +#endif } } @@ -1159,7 +1174,9 @@ namespace System.Data.ProviderBase { DbConnectionInternal obj = null; SysTx.Transaction transaction = null; +#if !MOBILE PerformanceCounters.SoftConnectsPerSecond.Increment(); +#endif Bid.PoolerTrace(" %d#, Getting connection.\n", ObjectID); @@ -1364,7 +1381,9 @@ namespace System.Data.ProviderBase { /// Inner connection that will be replaced /// A new inner connection that is attached to the internal DbConnectionInternal ReplaceConnection(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) { +#if !MOBILE PerformanceCounters.SoftConnectsPerSecond.Increment(); +#endif Bid.PoolerTrace(" %d#, replacing connection.\n", ObjectID); DbConnectionInternal newConnection = UserCreateRequest(owningObject, userOptions, oldConnection); @@ -1402,7 +1421,9 @@ namespace System.Data.ProviderBase { if (null != obj) { Bid.PoolerTrace(" %d#, Connection %d#, Popped from general pool.\n", ObjectID, obj.ObjectID); +#if !MOBILE PerformanceCounters.NumberOfFreeConnections.Decrement(); +#endif } return(obj); } @@ -1416,7 +1437,9 @@ namespace System.Data.ProviderBase { if (null != obj) { Bid.PoolerTrace(" %d#, Connection %d#, Popped from transacted pool.\n", ObjectID, obj.ObjectID); +#if !MOBILE PerformanceCounters.NumberOfFreeConnections.Decrement(); +#endif if (obj.IsTransactionRoot) { try { @@ -1560,14 +1583,17 @@ namespace System.Data.ProviderBase { _stackNew.Push(obj); _waitHandles.PoolSemaphore.Release(1); +#if !MOBILE PerformanceCounters.NumberOfFreeConnections.Increment(); - +#endif } internal void PutObject(DbConnectionInternal obj, object owningObject) { Debug.Assert(null != obj, "null obj?"); +#if !MOBILE PerformanceCounters.SoftDisconnectsPerSecond.Increment(); +#endif // Once a connection is closing (which is the state that we're in at // this point in time) you cannot delegate a transaction to or enlist @@ -1671,7 +1697,9 @@ namespace System.Data.ProviderBase { DbConnectionInternal obj = reclaimedObjects[i]; Bid.PoolerTrace(" %d#, Connection %d#, Reclaiming.\n", ObjectID, obj.ObjectID); +#if !MOBILE PerformanceCounters.NumberOfReclaimedConnections.Increment(); +#endif emancipatedObjectFound = true; diff --git a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs index 17fc317bbe7..91fb7aacb90 100644 --- a/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs +++ b/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs @@ -145,7 +145,9 @@ namespace System.Data.ProviderBase { DbConnectionFactory connectionFactory = pool.ConnectionFactory; +#if !MOBILE connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement(); +#endif connectionFactory.QueuePoolForRelease(pool, true); } } @@ -198,7 +200,9 @@ namespace System.Data.ProviderBase { newPool.Startup(); // must start pool before usage bool addResult = _poolCollection.TryAdd(currentIdentity, newPool); Debug.Assert(addResult, "No other pool with current identity should exist at this point"); +#if !MOBILE connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Increment(); +#endif pool = newPool; newPool = null; } @@ -275,7 +279,9 @@ namespace System.Data.ProviderBase { // are completely empty. DbConnectionFactory connectionFactory = pool.ConnectionFactory; +#if !MOBILE connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement(); +#endif connectionFactory.QueuePoolForRelease(pool, false); } else { diff --git a/mcs/class/referencesource/System.Data/System/Data/SQLTypes/SQLFileStream.cs b/mcs/class/referencesource/System.Data/System/Data/SQLTypes/SQLFileStream.cs index 3491985f953..05bb96edc14 100644 --- a/mcs/class/referencesource/System.Data/System/Data/SQLTypes/SQLFileStream.cs +++ b/mcs/class/referencesource/System.Data/System/Data/SQLTypes/SQLFileStream.cs @@ -785,7 +785,11 @@ namespace System.Data.SqlTypes bRevertAssert = true; System.Diagnostics.Debug.Assert ( m_fs == null ); +#if MOBILE + m_fs = new System.IO.FileStream ( hFile.DangerousGetHandle (), access, ( ( options & System.IO.FileOptions.Asynchronous ) != 0 ), DefaultBufferSize ); +#else m_fs = new System.IO.FileStream ( hFile, access, DefaultBufferSize, ( ( options & System.IO.FileOptions.Asynchronous ) != 0 ) ); +#endif } finally { diff --git a/mcs/class/referencesource/System.Data/System/Data/SqlClient/LocalDBAPI.cs b/mcs/class/referencesource/System.Data/System/Data/SqlClient/LocalDBAPI.cs index f942a2d03dc..e29bda4cad5 100644 --- a/mcs/class/referencesource/System.Data/System/Data/SqlClient/LocalDBAPI.cs +++ b/mcs/class/referencesource/System.Data/System/Data/SqlClient/LocalDBAPI.cs @@ -304,6 +304,7 @@ namespace System.Data if (s_configurableInstances == null) { Dictionary tempConfigurableInstances = new Dictionary(StringComparer.OrdinalIgnoreCase); +#if !NO_CONFIGURATION object section = PrivilegedConfigurationManager.GetSection("system.data.localdb"); if (section != null) // if no section just skip creation { @@ -318,6 +319,7 @@ namespace System.Data } } else +#endif Bid.Trace( " No system.data.localdb section found in configuration"); s_configurableInstances = tempConfigurableInstances; } diff --git a/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnection.cs b/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnection.cs index f5639c3f288..ac04c011fb5 100644 --- a/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnection.cs +++ b/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnection.cs @@ -802,6 +802,7 @@ namespace System.Data.SqlClient } } +#if !MOBILE public void EnlistDistributedTransaction(System.EnterpriseServices.ITransaction transaction) { if (IsContextConnection) { throw SQL.NotAvailableOnContextConnection(); @@ -809,6 +810,7 @@ namespace System.Data.SqlClient EnlistDistributedTransactionHelper(transaction); } +#endif override public void Open() { IntPtr hscp; diff --git a/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnectionFactory.cs b/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnectionFactory.cs index 3b23e31a046..37766e5f465 100644 --- a/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnectionFactory.cs +++ b/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnectionFactory.cs @@ -180,14 +180,16 @@ namespace System.Data.SqlClient throw SQL.NotAvailableOnContextConnection(); } - NameValueCollection settings = (NameValueCollection)PrivilegedConfigurationManager.GetSection("system.data.sqlclient"); Stream XMLStream =null; +#if !NO_CONFIGURATION + NameValueCollection settings = (NameValueCollection)PrivilegedConfigurationManager.GetSection("system.data.sqlclient"); if (settings != null){ string [] values = settings.GetValues(_metaDataXml); if (values != null) { XMLStream = ADP.GetXmlStreamFromValues(values, _metaDataXml); } } +#endif // if the xml was not obtained from machine.config use the embedded XML resource if (XMLStream == null){ @@ -306,9 +308,11 @@ namespace System.Data.SqlClient public static readonly SqlPerformanceCounters SingletonInstance = new SqlPerformanceCounters(); +#if !MOBILE [System.Diagnostics.PerformanceCounterPermissionAttribute(System.Security.Permissions.SecurityAction.Assert, PermissionAccess=PerformanceCounterPermissionAccess.Write, MachineName=".", CategoryName=CategoryName)] private SqlPerformanceCounters() : base (CategoryName, CategoryHelp) { } +#endif } } diff --git a/mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParserStaticMethods.cs b/mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParserStaticMethods.cs index 2f58d45a84c..3b85484e02c 100644 --- a/mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParserStaticMethods.cs +++ b/mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParserStaticMethods.cs @@ -33,6 +33,7 @@ namespace System.Data.SqlClient { [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)] static internal void AliasRegistryLookup(ref string host, ref string protocol) { +#if !MOBILE if (!ADP.IsEmpty(host)) { const String folder = "SOFTWARE\\Microsoft\\MSSQLServer\\Client\\ConnectTo"; // Put a try...catch... around this so we don't abort ANY connection if we can't read the registry. @@ -87,6 +88,7 @@ namespace System.Data.SqlClient { } } } +#endif } // Encrypt password to be sent to SQL Server -- 2.25.1