Skip to content

Commit

Permalink
Drop NS16 (DNET-866)
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed Aug 1, 2019
1 parent 3b4cd96 commit 6f63a57
Show file tree
Hide file tree
Showing 61 changed files with 32 additions and 276 deletions.
1 change: 0 additions & 1 deletion Provider/build.ps1
Expand Up @@ -30,7 +30,6 @@ function Build() {

function Pack() {
7z a -mx=9 $outDir\FirebirdSql.Data.FirebirdClient-$version-net452.7z $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\net452\FirebirdSql.Data.FirebirdClient.dll $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\net452\FirebirdSql.Data.FirebirdClient.pdb | Out-Null
7z a -mx=9 $outDir\FirebirdSql.Data.FirebirdClient-$version-netstandard1.6.7z $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\netstandard1.6\FirebirdSql.Data.FirebirdClient.dll $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\netstandard1.6\FirebirdSql.Data.FirebirdClient.pdb | Out-Null
7z a -mx=9 $outDir\FirebirdSql.Data.FirebirdClient-$version-netstandard2.0.7z $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\netstandard2.0\FirebirdSql.Data.FirebirdClient.dll $baseDir\src\FirebirdSql.Data.FirebirdClient\bin\$Configuration\netstandard2.0\FirebirdSql.Data.FirebirdClient.pdb | Out-Null

7z a -mx=9 $outDir\EntityFramework.Firebird-$version-net452.7z $baseDir\src\EntityFramework.Firebird\bin\$Configuration\net452\EntityFramework.Firebird.dll $baseDir\src\EntityFramework.Firebird\bin\$Configuration\net452\EntityFramework.Firebird.pdb | Out-Null
Expand Down
Expand Up @@ -309,12 +309,7 @@ private IPAddress GetIPAddress(string dataSource)
return ipaddress;
}

#if NETSTANDARD1_6
var addresses = Dns.GetHostEntryAsync(dataSource).GetAwaiter().GetResult().AddressList;
#else
var addresses = Dns.GetHostEntry(dataSource).AddressList;
#endif

foreach (var address in addresses)
{
// IPv4 priority
Expand Down
Expand Up @@ -173,7 +173,7 @@ protected virtual void SendAttachToBuffer(DatabaseParameterBuffer dpb, string da
{
dpb.Append(IscCodes.isc_dpb_password, Password);
}
XdrStream.WriteBuffer(Encoding2.Default.GetBytes(database));
XdrStream.WriteBuffer(Encoding.Default.GetBytes(database));
XdrStream.WriteBuffer(dpb.ToArray());
}

Expand Down Expand Up @@ -282,7 +282,7 @@ protected virtual void SendCreateToBuffer(DatabaseParameterBuffer dpb, string da
{
dpb.Append(IscCodes.isc_dpb_password, Password);
}
XdrStream.WriteBuffer(Encoding2.Default.GetBytes(database));
XdrStream.WriteBuffer(Encoding.Default.GetBytes(database));
XdrStream.WriteBuffer(dpb.ToArray());
}

Expand Down
Expand Up @@ -48,17 +48,10 @@ internal static class FbClientFactory
static FbClientFactory()
{
cache = new ConcurrentDictionary<string, IFbClient>();
#if NETSTANDARD1_6
injectionTypes = new HashSet<Type>(typeof(FbClientFactory).GetTypeInfo().Assembly.GetTypes()
.Where(x => !x.GetTypeInfo().IsAbstract && !x.GetTypeInfo().IsInterface)
.Where(x => typeof(IFirebirdHandle).IsAssignableFrom(x))
.Select(x => x.MakeByRefType()));
#else
injectionTypes = new HashSet<Type>(typeof(FbClientFactory).Assembly.GetTypes()
.Where(x => !x.IsAbstract && !x.IsInterface)
.Where(x => typeof(IFirebirdHandle).IsAssignableFrom(x))
.Select(x => x.MakeByRefType()));
#endif
}

/// <summary>
Expand Down Expand Up @@ -243,7 +236,7 @@ private static IFbClient CreateInstance(TypeBuilder tb)
var t = tb.CreateTypeInfo().AsType();

#if DEBUG
#if !NETSTANDARD1_6 && !NETSTANDARD2_0
#if !NETSTANDARD2_0
var ab = (AssemblyBuilder)tb.Assembly;
ab.Save("DynamicAssembly.dll");
#endif
Expand Down Expand Up @@ -272,18 +265,14 @@ private static TypeBuilder CreateTypeBuilder(string baseName)
assemblyName.Name = baseName + "_Assembly";

// We create the dynamic assembly in our current AppDomain
#if NETSTANDARD1_6 || NETSTANDARD2_0
#if NETSTANDARD2_0
var assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
#else
var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave);
#endif

// Generate the actual module (which is the DLL itself)
#if NETSTANDARD1_6 || NETSTANDARD2_0
var moduleBuilder = assemblyBuilder.DefineDynamicModule(baseName + "_Module");
#else
var moduleBuilder = assemblyBuilder.DefineDynamicModule(baseName + "_Module", baseName + ".dll");
#endif

// Add our type to the module.
return moduleBuilder.DefineType(baseName + "_Class", TypeAttributes.Class);
Expand Down Expand Up @@ -315,11 +304,7 @@ private static void ShutdownEntryPointWrapper(IFbClient fbClient)
{
fbClient.fb_shutdown(0, 0);
}
#if NETSTANDARD1_6
catch (Exception ex) when (ex.GetType().Name == "EntryPointNotFoundException")
#else
catch (EntryPointNotFoundException)
#endif
{ }
}
}
Expand Down
Expand Up @@ -60,7 +60,7 @@ public static IscException ParseStatusVector(IntPtr[] statusVector, Charset char
{
var ptr = statusVector[i++];
var s = Marshal.PtrToStringAnsi(ptr);
var value = charset.GetString(Encoding2.Default.GetBytes(s));
var value = charset.GetString(Encoding.Default.GetBytes(s));
exception.Errors.Add(new IscError(arg.AsInt(), value));
}
break;
Expand All @@ -71,7 +71,7 @@ public static IscException ParseStatusVector(IntPtr[] statusVector, Charset char

var ptr = statusVector[i++];
var s = Marshal.PtrToStringAnsi(ptr);
var value = charset.GetString(Encoding2.Default.GetBytes(s));
var value = charset.GetString(Encoding.Default.GetBytes(s));
exception.Errors.Add(new IscError(arg.AsInt(), value));
}
break;
Expand All @@ -84,7 +84,7 @@ public static IscException ParseStatusVector(IntPtr[] statusVector, Charset char
{
var ptr = statusVector[i++];
var s = Marshal.PtrToStringAnsi(ptr);
var value = charset.GetString(Encoding2.Default.GetBytes(s));
var value = charset.GetString(Encoding.Default.GetBytes(s));
exception.Errors.Add(new IscError(arg.AsInt(), value));
}
break;
Expand Down
Expand Up @@ -131,7 +131,7 @@ public void CreateDatabase(DatabaseParameterBuffer dpb, string dataSource, int p
{
CheckCryptKeyForSupport(cryptKey);

var databaseBuffer = Encoding2.Default.GetBytes(database);
var databaseBuffer = Encoding.Default.GetBytes(database);

ClearStatusVector();

Expand Down Expand Up @@ -190,7 +190,7 @@ public void Attach(DatabaseParameterBuffer dpb, string dataSource, int port, str
{
CheckCryptKeyForSupport(cryptKey);

var databaseBuffer = Encoding2.Default.GetBytes(database);
var databaseBuffer = Encoding.Default.GetBytes(database);

ClearStatusVector();

Expand Down
Expand Up @@ -166,7 +166,7 @@ public Charset(int id, string name, int bytesPerCharacter, string systemName)
switch (_systemName)
{
case None:
_encoding = Encoding2.Default;
_encoding = Encoding.Default;
_isNone = true;
break;
case Octets:
Expand Down
Expand Up @@ -548,19 +548,12 @@ internal static FbWireCrypt GetWireCrypt(string key, TryGetValueDelegate tryGetV
private static string ExpandDataDirectory(string s)
{
const string DataDirectoryKeyword = "|DataDirectory|";
#if NETSTANDARD1_6
if (s.IndexOf(DataDirectoryKeyword, StringComparison.OrdinalIgnoreCase) != -1)
throw new NotSupportedException();

return s;
#else
if (s == null)
return s;

var dataDirectoryLocation = (string)AppDomain.CurrentDomain.GetData("DataDirectory") ?? string.Empty;
var pattern = string.Format("{0}{1}?", Regex.Escape(DataDirectoryKeyword), Regex.Escape(Path.DirectorySeparatorChar.ToString()));
return Regex.Replace(s, pattern, dataDirectoryLocation + Path.DirectorySeparatorChar, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
#endif
}

private static T ParseEnum<T>(string value, string name) where T : struct
Expand Down
Expand Up @@ -51,7 +51,7 @@ public void Append(int type, int value)

public void Append(int type, string content)
{
Append(type, Encoding2.Default.GetBytes(content));
Append(type, Encoding.Default.GetBytes(content));
}

public void Append(int type, byte[] buffer)
Expand Down
31 changes: 0 additions & 31 deletions Provider/src/FirebirdSql.Data.FirebirdClient/Common/Encoding2.cs

This file was deleted.

Expand Up @@ -29,7 +29,7 @@ public EventParameterBuffer()

public void Append(string content, int actualCount)
{
Append(Encoding2.Default.GetBytes(content), actualCount);
Append(Encoding.Default.GetBytes(content), actualCount);
}

public void Append(byte[] content, int actualCount)
Expand Down
Expand Up @@ -22,9 +22,7 @@
using System.Reflection;
using System.Resources;
using System.Linq;
#if !NETSTANDARD1_6
using System.Runtime.Serialization;
#endif

namespace FirebirdSql.Data.Common
{
Expand Down Expand Up @@ -113,14 +111,12 @@ public static IscException ForTypeErrorCodeIntParamStrParam(int type, int errorC
return result;
}

#if !NETSTANDARD1_6
private IscException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Errors = (List<IscError>)info.GetValue(nameof(Errors), typeof(List<IscError>));
ErrorCode = info.GetInt32(nameof(ErrorCode));
}
#endif

public void BuildExceptionData()
{
Expand All @@ -129,14 +125,12 @@ public void BuildExceptionData()
BuildExceptionMessage();
}

#if !NETSTANDARD1_6
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue(nameof(Errors), Errors);
info.AddValue(nameof(ErrorCode), ErrorCode);
}
#endif

public override string ToString() => _message;

Expand Down
10 changes: 5 additions & 5 deletions Provider/src/FirebirdSql.Data.FirebirdClient/Common/IscHelper.cs
Expand Up @@ -64,14 +64,14 @@ public static List<object> ParseDatabaseInfo(byte[] buffer)
* - 1 byte containing the length, l, of the site name in bytes
* - A string of l bytes, containing the site name
*/
var dbFile = Encoding2.Default.GetString(buffer, pos + 2, buffer[pos + 1]);
var dbFile = Encoding.Default.GetString(buffer, pos + 2, buffer[pos + 1]);
var sitePos = pos + 2 + buffer[pos + 1];
int siteLength = buffer[sitePos];
var siteName = Encoding2.Default.GetString(buffer, sitePos + 1, siteLength);
var siteName = Encoding.Default.GetString(buffer, sitePos + 1, siteLength);

sitePos += siteLength + 1;
siteLength = buffer[sitePos];
siteName += "." + Encoding2.Default.GetString(buffer, sitePos + 1, siteLength);
siteName += "." + Encoding.Default.GetString(buffer, sitePos + 1, siteLength);

info.Add(siteName + ":" + dbFile);
break;
Expand Down Expand Up @@ -134,7 +134,7 @@ public static List<object> ParseDatabaseInfo(byte[] buffer)
for (var i = 0; i < count; i++)
{
var messageLength = buffer[messagePosition + 1];
info.Add(Encoding2.Default.GetString(buffer, messagePosition + 2, messageLength));
info.Add(Encoding.Default.GetString(buffer, messagePosition + 2, messageLength));
messagePosition += 1 + messageLength;
}
break;
Expand Down Expand Up @@ -298,7 +298,7 @@ public static List<object> ParseDatabaseInfo(byte[] buffer)

case IscCodes.isc_info_user_names:
// Active user name
info.Add(Encoding2.Default.GetString(buffer, pos + 1, buffer[pos]));
info.Add(Encoding.Default.GetString(buffer, pos + 1, buffer[pos]));
break;
}

Expand Down
Expand Up @@ -41,12 +41,12 @@ public void Append(int type, int value)

public void Append(int type, string value)
{
Append(type, Encoding2.Default.GetBytes(value));
Append(type, Encoding.Default.GetBytes(value));
}

public void Append(byte type, string value)
{
Append(type, Encoding2.Default.GetBytes(value));
Append(type, Encoding.Default.GetBytes(value));
}

public void Append(int type, byte[] value)
Expand Down
Expand Up @@ -29,10 +29,8 @@ static ShutdownHelper()
{
_pools = new ConcurrentBag<Action>();
_fbClients = new ConcurrentBag<Action>();
#if !NETSTANDARD1_6
AppDomain.CurrentDomain.DomainUnload += (sender, e) => HandleDomainUnload();
AppDomain.CurrentDomain.ProcessExit += (sender, e) => HandleProcessShutdown();
#endif
}

internal static void RegisterPoolCleanup(Action item)
Expand Down
Expand Up @@ -35,7 +35,7 @@ public void Append(int type, short value)

public void Append(int type, string content)
{
Append(type, Encoding2.Default.GetBytes(content));
Append(type, Encoding.Default.GetBytes(content));
}

public void Append(int type, byte[] buffer)
Expand Down
Expand Up @@ -31,10 +31,7 @@

namespace FirebirdSql.Data.FirebirdClient
{
public sealed class FbCommand : DbCommand
#if !NETSTANDARD1_6
, ICloneable
#endif
public sealed class FbCommand : DbCommand, ICloneable
{
#region Fields

Expand Down Expand Up @@ -380,11 +377,7 @@ protected override void Dispose(bool disposing)

#region ICloneable Methods

#if NETSTANDARD1_6
internal object Clone()
#else
object ICloneable.Clone()
#endif
{
var command = new FbCommand();

Expand All @@ -404,11 +397,7 @@ object ICloneable.Clone()

for (var i = 0; i < Parameters.Count; i++)
{
#if NETSTANDARD1_6
command.Parameters.Add(Parameters[i].Clone());
#else
command.Parameters.Add(((ICloneable)Parameters[i]).Clone());
#endif
}

return command;
Expand Down
Expand Up @@ -15,7 +15,6 @@

//$Authors = Carlos Guzman Alvarez, Jiri Cincura (jiri@cincura.net)

#if !NETSTANDARD1_6
using System;
using System.ComponentModel;
using System.Data;
Expand Down Expand Up @@ -295,4 +294,3 @@ private void RowUpdatingHandler(object sender, FbRowUpdatingEventArgs e)
#endregion
}
}
#endif

0 comments on commit 6f63a57

Please sign in to comment.