You've already forked linux-packaging-mono
Imported Upstream version 6.4.0.137
Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
parent
e9207cf623
commit
ef583813eb
183
mcs/class/System.Data/corefx/DataReaderExtensions.cs
Normal file
183
mcs/class/System.Data/corefx/DataReaderExtensions.cs
Normal file
@@ -0,0 +1,183 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Data.Common;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Data
|
||||
{
|
||||
// copied from CoreFX (NS2.1)
|
||||
public static class DataReaderExtensions
|
||||
{
|
||||
public static bool GetBoolean(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetBoolean(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static byte GetByte(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetByte(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static long GetBytes(this DbDataReader reader, string name, long dataOffset, byte[] buffer, int bufferOffset, int length)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetBytes(reader.GetOrdinal(name), dataOffset, buffer, bufferOffset, length);
|
||||
}
|
||||
|
||||
public static char GetChar(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetChar(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static long GetChars(this DbDataReader reader, string name, long dataOffset, char[] buffer, int bufferOffset, int length)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetChars(reader.GetOrdinal(name), dataOffset, buffer, bufferOffset, length);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static DbDataReader GetData(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetData(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static string GetDataTypeName(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetDataTypeName(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static DateTime GetDateTime(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetDateTime(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static decimal GetDecimal(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetDecimal(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static double GetDouble(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetDouble(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static Type GetFieldType(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetFieldType(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static T GetFieldValue<T>(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetFieldValue<T>(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static Task<T> GetFieldValueAsync<T>(this DbDataReader reader, string name, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetFieldValueAsync<T>(reader.GetOrdinal(name), cancellationToken);
|
||||
}
|
||||
|
||||
public static float GetFloat(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetFloat(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static Guid GetGuid(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetGuid(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static short GetInt16(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetInt16(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static int GetInt32(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetInt32(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static long GetInt64(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetInt64(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static Type GetProviderSpecificFieldType(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetProviderSpecificFieldType(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static object GetProviderSpecificValue(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetProviderSpecificValue(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static Stream GetStream(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetStream(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static string GetString(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetString(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static TextReader GetTextReader(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetTextReader(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static object GetValue(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.GetValue(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static bool IsDBNull(this DbDataReader reader, string name)
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.IsDBNull(reader.GetOrdinal(name));
|
||||
}
|
||||
|
||||
public static Task<bool> IsDBNullAsync(this DbDataReader reader, string name, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
AssertNotNull(reader);
|
||||
return reader.IsDBNullAsync(reader.GetOrdinal(name), cancellationToken);
|
||||
}
|
||||
|
||||
private static void AssertNotNull(DbDataReader reader)
|
||||
{
|
||||
if (reader == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(reader));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
mcs/class/System.Data/corefx/DbProviderFactories.mobile.cs
Normal file
21
mcs/class/System.Data/corefx/DbProviderFactories.mobile.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
#if MOBILE
|
||||
namespace System.Data.Common
|
||||
{
|
||||
public static partial class DbProviderFactories
|
||||
{
|
||||
public static System.Data.Common.DbProviderFactory GetFactory(System.Data.Common.DbConnection connection) => throw new PlatformNotSupportedException();
|
||||
public static System.Data.Common.DbProviderFactory GetFactory(System.Data.DataRow providerRow) => throw new PlatformNotSupportedException();
|
||||
public static System.Data.Common.DbProviderFactory GetFactory(string providerInvariantName) => throw new PlatformNotSupportedException();
|
||||
public static System.Data.DataTable GetFactoryClasses() => throw new PlatformNotSupportedException();
|
||||
public static System.Collections.Generic.IEnumerable<string> GetProviderInvariantNames() => throw new PlatformNotSupportedException();
|
||||
public static void RegisterFactory(string providerInvariantName, System.Data.Common.DbProviderFactory factory) => throw new PlatformNotSupportedException();
|
||||
public static void RegisterFactory(string providerInvariantName, string factoryTypeAssemblyQualifiedName) => throw new PlatformNotSupportedException();
|
||||
public static void RegisterFactory(string providerInvariantName, System.Type providerFactoryClass) => throw new PlatformNotSupportedException();
|
||||
public static bool TryGetFactory(string providerInvariantName, out System.Data.Common.DbProviderFactory factory) => throw new PlatformNotSupportedException();
|
||||
public static bool UnregisterFactory(string providerInvariantName) => throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user