Add #if-s for mobile builds.
authorAtsushi Eno <atsushieno@gmail.com>
Wed, 18 Mar 2015 07:58:38 +0000 (15:58 +0800)
committerMarek Safar <marek.safar@gmail.com>
Mon, 2 May 2016 22:08:06 +0000 (00:08 +0200)
15 files changed:
mcs/class/referencesource/System.Data/System/Data/Common/AdapterUtil.cs
mcs/class/referencesource/System.Data/System/Data/Common/NativeMethods.cs
mcs/class/referencesource/System.Data/System/Data/Common/System.Data_BID.cs
mcs/class/referencesource/System.Data/System/Data/Common/UnsafeNativeMethods.cs
mcs/class/referencesource/System.Data/System/Data/DataSet.cs
mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionFactory.cs
mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionHelper.cs
mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionInternal.cs
mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPool.cs
mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs
mcs/class/referencesource/System.Data/System/Data/SQLTypes/SQLFileStream.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/LocalDBAPI.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnection.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlConnectionFactory.cs
mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParserStaticMethods.cs

index 71092075d227694f12a3b1b21c6ca70412849015..bdd182d74424d6de44014f04c0711355decd0d46 100644 (file)
@@ -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) {
index ba5eb1fc22051133619156af29d3c238d5469631..ebcf3fc72e4aed0ce11fc9e3f2a17989bdac8680 100644 (file)
@@ -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 {
index 8cff81a5dc695d58a861e7ec8939ab451ad56b4e..c95844c82a82efbecd9aba0a91827f07157dfdc3 100644 (file)
@@ -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) {
index 47a1abb70c878194a8c05b2f30d31d190cc9782c..0c368cfcabed92023220f1af767d164ef6ee3192 100644 (file)
@@ -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
index 504cdd268bba444611568abb32a7ae89b3f41cd5..cb0c072a6596823dda1c71424cf7f7567719a28b 100644 (file)
@@ -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
 }
index c9fe482c8b673be288b7d3c633ef6de266d9304a..6832381eb7c7078914760959de4a48b86b89a961 100644 (file)
@@ -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("<prov.DbConnectionFactory.CreateNonPooledConnection|RES|CPOOL> %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("<prov.DbConnectionFactory.CreatePooledConnection|RES|CPOOL> %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("<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> %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("<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> %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) {
index 0e562288294d7ecaad7fe7122b0d9dc668a8a03f..8c09bbc4c0824f09a5544e4db94abecf78cb5e5a 100644 (file)
@@ -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();
index 73541107c73d21db23747d5c99b149d1a9a25544..96a6729dd25969420d40e6a7ba541740cebb3071 100644 (file)
@@ -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("<prov.DbConnectionInternal.SetInStasis|RES|CPOOL> %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("<prov.DbConnectionInternal.TerminateStasis|RES|CPOOL> %d#, Delegated Transaction has ended, connection is closed/leaked.  Disposing.\n", ObjectID);
             }
+#if !MOBILE
             PerformanceCounters.NumberOfStasisConnections.Decrement();
+#endif
             _isInStasis = false;
         }
 
index a5b05119969f11d9bfb8d8f88ab79b26c800ff12..50ef20b0f8e0d2d1f74136baa642ca5a8fcb0291 100644 (file)
@@ -235,8 +235,9 @@ namespace System.Data.ProviderBase {
                     Bid.PoolerTrace("<prov.DbConnectionPool.TransactedConnectionPool.PutTransactedObject|RES|CPOOL> %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("<prov.DbConnectionPool.DestroyObject|RES|CPOOL> %d#, Connection %d#, Removed from pool.\n", ObjectID, obj.ObjectID);
+#if !MOBILE
                     PerformanceCounters.NumberOfPooledConnections.Decrement();
+#endif
                 }
                 obj.Dispose();
 
                 Bid.PoolerTrace("<prov.DbConnectionPool.DestroyObject|RES|CPOOL> %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("<prov.DbConnectionPool.GetConnection|RES|CPOOL> %d#, Getting connection.\n", ObjectID);
 
@@ -1364,7 +1381,9 @@ namespace System.Data.ProviderBase {
         /// <param name="oldConnection">Inner connection that will be replaced</param>
         /// <returns>A new inner connection that is attached to the <paramref name="owningObject"/></returns>
         internal DbConnectionInternal ReplaceConnection(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) {
+#if !MOBILE
             PerformanceCounters.SoftConnectsPerSecond.Increment();
+#endif
             Bid.PoolerTrace("<prov.DbConnectionPool.ReplaceConnection|RES|CPOOL> %d#, replacing connection.\n", ObjectID);
 
             DbConnectionInternal newConnection = UserCreateRequest(owningObject, userOptions, oldConnection);
@@ -1402,7 +1421,9 @@ namespace System.Data.ProviderBase {
 
             if (null != obj) {
                 Bid.PoolerTrace("<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> %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("<prov.DbConnectionPool.GetFromTransactedPool|RES|CPOOL> %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("<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> %d#, Connection %d#, Reclaiming.\n", ObjectID, obj.ObjectID);
+#if !MOBILE
                 PerformanceCounters.NumberOfReclaimedConnections.Increment();
+#endif
 
                 emancipatedObjectFound = true;
 
index 17fc317bbe7ace932d30a147e381ec8fc66e86a9..91fb7aacb908766942fb51509fb23c1c40b0e4d6 100644 (file)
@@ -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 {
index 3491985f95315577a85691991689ac7180dfcb52..05bb96edc14df350da3f1e542e3e64805d5576dc 100644 (file)
@@ -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
                 {
index f942a2d03dcb6ce5c7fe3dc6f453e148d6d4ade6..e29bda4cad505c6df106b29e11851d3f92068298 100644 (file)
@@ -304,6 +304,7 @@ namespace System.Data
                     if (s_configurableInstances == null)
                     {
                         Dictionary<string, InstanceInfo> tempConfigurableInstances = new Dictionary<string, InstanceInfo>(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( "<sc.LocalDBAPI.CreateLocalDBInstance> No system.data.localdb section found in configuration");
                         s_configurableInstances = tempConfigurableInstances;
                     }
index f5639c3f288c1dd1488eae9ae8a893a5af5c89e3..ac04c011fb54b0fbcded1fbb2058aae07f247275 100644 (file)
@@ -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;
index 3b23e31a0462555186d4453a4bad238ef7008941..37766e5f465ac3d742bf4ab291f825231e7a7777 100644 (file)
@@ -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
     }
 }
 
index 2f58d45a84cd1611b754b93f0402c5609058a580..3b85484e02cf477f64771cc887c392fb5ccda4ae 100644 (file)
@@ -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