Skip to content

Commit

Permalink
Merge pull request #67 from linq2db/master
Browse files Browse the repository at this point in the history
Release 4.0.0
  • Loading branch information
MaceWindu authored Jun 10, 2022
2 parents f82b58f + 8c69972 commit 135f9bb
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 151 deletions.
2 changes: 1 addition & 1 deletion Build/BuildNuspecs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Set-StrictMode -Version Latest
if ($version) {

$nsUri = 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'
$authors = 'Igor Tkachev, Ilya Chudin, Svyatoslav Danyliv, Dmitry Lukashenko'
$authors = 'Linq To DB Team'
$ns = @{ns=$nsUri}
$dotlessVersion = $version -replace '\.',''
$commit = (git rev-parse HEAD)
Expand Down
8 changes: 4 additions & 4 deletions Build/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
variables:
solution: 'linq2db.LINQPad.sln'
build_configuration: 'Release'
assemblyVersion: 3.6.0.0
nugetVersion: 3.6.0
nugetDevVersion: 3.6.1
nugetPRVersion: 3.6.1
assemblyVersion: 4.0.0.0
nugetVersion: 4.0.0
nugetDevVersion: 4.0.1
nugetPRVersion: 4.0.1
artifact_lpx: 'lpx'
artifact_lpx6: 'lpx6'
artifact_nuget: 'nuget'
Expand Down
26 changes: 13 additions & 13 deletions Build/linq2db.LINQPad.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
<readme>README.md</readme>
<dependencies>
<group targetFramework=".NETCoreApp3.1">
<dependency id="LINQPad.Reference" version="1.1.0" />
<dependency id="linq2db" version="3.6.0" />
<dependency id="LINQPad.Reference" version="1.3.0" />
<dependency id="linq2db" version="4.0.1" />

<dependency id="Humanizer.Core" version="2.13.14" />
<dependency id="CodeJam" version="4.0.1" />
<dependency id="Humanizer.Core" version="2.14.1" />
<dependency id="CodeJam" version="4.1.0" />
<dependency id="System.Configuration.ConfigurationManager" version="6.0.0" />
<dependency id="Microsoft.CodeAnalysis.CSharp" version="4.0.1" />
<dependency id="System.Text.Json" version="5.0.2" />
<dependency id="dotMorten.Microsoft.SqlServer.Types" version="1.3.0" />
<dependency id="Microsoft.CodeAnalysis.CSharp" version="4.2.0" />
<dependency id="System.Text.Json" version="6.0.4" />
<dependency id="dotMorten.Microsoft.SqlServer.Types" version="1.5.0" />

<dependency id="FirebirdSql.Data.FirebirdClient" version="8.5.4" />
<dependency id="MySqlConnector" version="2.0.0" />
<dependency id="FirebirdSql.Data.FirebirdClient" version="9.0.1" />
<dependency id="MySqlConnector" version="2.1.10" />
<dependency id="AdoNetCore.AseClient" version="0.19.2" />
<dependency id="System.Data.SQLite.Core" version="1.0.115.5" />
<dependency id="System.Data.SQLite.Core" version="1.0.116" />
<dependency id="System.Data.SqlClient" version="4.8.3" />
<dependency id="System.Data.Odbc" version="5.0.0" />
<dependency id="System.Data.OleDb" version="5.0.0" />
<dependency id="Npgsql" version="6.0.0" />
<dependency id="Oracle.ManagedDataAccess.Core" version="3.21.4" />
<dependency id="IBM.Data.DB2.Core" version="3.1.0.500" />
<dependency id="Npgsql" version="6.0.4" />
<dependency id="Oracle.ManagedDataAccess.Core" version="3.21.61" />
<dependency id="IBM.Data.DB2.Core" version="3.1.0.600" />
</group>
</dependencies>
<frameworkReferences>
Expand Down
38 changes: 19 additions & 19 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
<Project>
<ItemGroup>
<PackageVersion Include="linq2db" Version="3.6.0" />
<PackageVersion Include="linq2db" Version="4.0.1" />

<PackageVersion Include="LINQPad.Reference" Version="1.1.0" />
<PackageVersion Include="LINQPad.Reference" Version="1.3.0" />

<PackageVersion Include="Humanizer.Core" Version="2.13.14" />
<PackageVersion Include="CodeJam" Version="4.0.1" />
<PackageVersion Include="Humanizer.Core" Version="2.14.1" />
<PackageVersion Include="CodeJam" Version="4.1.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.4" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Buffers" Version="4.5.1" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<PackageVersion Include="MySqlConnector" Version="2.0.0" />
<PackageVersion Include="MySqlConnector" Version="2.1.10" />
<PackageVersion Include="AdoNetCore.AseClient" Version="0.19.2" />
<PackageVersion Include="IBM.Data.DB.Provider" Version="11.5.5010.4" GeneratePathProperty="true" />
<PackageVersion Include="System.Data.SQLite.Core" Version="1.0.115.5" />
<PackageVersion Include="System.Data.SQLite.Core" Version="1.0.116" />
<PackageVersion Include="System.Data.SqlClient" Version="4.8.3" />
<PackageVersion Include="Oracle.ManagedDataAccess" Version="19.13.0" />
<PackageVersion Include="Oracle.ManagedDataAccess.Core" Version="3.21.4" />
<PackageVersion Include="Oracle.ManagedDataAccess" Version="19.14.0" />
<PackageVersion Include="Oracle.ManagedDataAccess.Core" Version="3.21.61" />
<PackageVersion Include="System.Data.Odbc" Version="6.0.0" />
<PackageVersion Include="System.Data.OleDb" Version="6.0.0" />
<PackageVersion Include="IBM.Data.DB2.Core" Version="3.1.0.500" />
<PackageVersion Include="dotMorten.Microsoft.SqlServer.Types" Version="1.3.0" />
<PackageVersion Include="IBM.Data.DB2.Core" Version="3.1.0.600" />
<PackageVersion Include="dotMorten.Microsoft.SqlServer.Types" Version="1.5.0" />
<PackageVersion Include="Microsoft.SqlServer.Types" Version="14.0.1016.290" />
<!--<PackageVersion Include="linq2db4iSeries" Version="2.9.0" />-->
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461'">
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
<PackageVersion Include="Npgsql" Version="4.1.10" />
<PackageVersion Include="FirebirdSql.Data.FirebirdClient" Version="7.10.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
<PackageVersion Include="Npgsql" Version="4.1.10" />
<PackageVersion Include="FirebirdSql.Data.FirebirdClient" Version="7.10.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'net461' ">
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageVersion Include="Npgsql" Version="6.0.0" />
<PackageVersion Include="FirebirdSql.Data.FirebirdClient" Version="8.5.4" />
<PackageVersion Include="System.Text.Json" Version="6.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0" />
<PackageVersion Include="Npgsql" Version="6.0.4" />
<PackageVersion Include="FirebirdSql.Data.FirebirdClient" Version="9.0.1" />
<PackageVersion Include="System.Text.Json" Version="6.0.4" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016-2020 Igor Tkachev, Ilya Chudin, Svyatoslav Danyliv, Dmitry Lukashenko
Copyright (c) 2016-2022 Linq To DB Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Source/ConnectionViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public ProviderInfo(string name, string description)
public ConnectionViewModel()
{
_providers = new ObservableCollection<ProviderInfo>(
ProviderHelper.DynamicProviders.Select(p => new ProviderInfo(p.ProviderName, p.Description))
ProviderHelper.DynamicProviders.Select(p => new ProviderInfo(p.Name, p.Description))
.OrderBy(s => s.Description.ToLower()));

_optimizeJoins = true;
Expand Down
6 changes: 3 additions & 3 deletions Source/DriverHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace LinqToDB.LINQPad
{
static class DriverHelper
{
public const string Author = "Igor Tkachev, Ilya Chudin, Svyatoslav Danyliv, Dmitry Lukashenko";
public const string Author = "Linq To DB Team";

public static void Init()
{
Expand Down Expand Up @@ -116,9 +116,9 @@ public static bool ShowConnectionDialog(IConnectionInfo cxInfo, bool isNewConnec
};

cxInfo.DatabaseInfo.Provider = db.Connection.GetType().Namespace;
cxInfo.DatabaseInfo.Server = ((DbConnection)db.Connection).DataSource;
cxInfo.DatabaseInfo.Server = db.Connection.DataSource;
cxInfo.DatabaseInfo.Database = db.Connection.Database;
cxInfo.DatabaseInfo.DbVersion = ((DbConnection)db.Connection).ServerVersion;
cxInfo.DatabaseInfo.DbVersion = db.Connection.ServerVersion;
}
}
catch
Expand Down
2 changes: 1 addition & 1 deletion Source/LinqToDBDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public override List<ExplorerItem> GetSchemaAndBuildAssembly(
// hack to overwrite provider assembly references that target wrong runtime
// e.g. gen.References contains path to net5 MySqlConnector
// but GetCoreFxReferenceAssemblies returns netcoreapp3.1 runtime references
var coreAssemblies = GetCoreFxReferenceAssemblies();
var coreAssemblies = GetCoreFxReferenceAssemblies(cxInfo);
var runtimeToken = _runtimeTokenExtractor.Match(coreAssemblies[0]).Groups["token"].Value;
references.AddRange(coreAssemblies.Select(path => MetadataReference.CreateFromFile(path)));

Expand Down
4 changes: 2 additions & 2 deletions Source/Pluralization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static string ToPlural(string str)
var word = GetLastWord(str);
var newWord = word.Pluralize();

if (string.Equals(word, newWord, StringComparison.OrdinalIgnoreCase))
if (!string.Equals(word, newWord, StringComparison.OrdinalIgnoreCase))
{
if (char.IsUpper(word[0]))
newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1);
Expand All @@ -46,7 +46,7 @@ public static string ToSingular(string str)
var word = GetLastWord(str);
var newWord = word.Singularize();

if (string.Equals(word, newWord, StringComparison.OrdinalIgnoreCase))
if (!string.Equals(word, newWord, StringComparison.OrdinalIgnoreCase))
{
if (char.IsUpper(word[0]))
newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1);
Expand Down
70 changes: 20 additions & 50 deletions Source/ProviderHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,68 +25,46 @@ internal class ProviderHelper
static void AddDataProvider(DynamicProviderRecord providerInfo)
{
if (providerInfo == null) throw new ArgumentNullException(nameof(providerInfo));
_dynamicProviders.Add(providerInfo.ProviderName, providerInfo);
_dynamicProviders.Add(providerInfo.Name, providerInfo);
}

static ProviderHelper()
{
InitializeDataProviders();
}

//static class DB2iSeriesProviderName
//{
// public const string DB2 = "DB2.iSeries";
//}

static void InitializeDataProviders()
{
AddDataProvider(new DynamicProviderRecord(ProviderName.Access , "Microsoft Access (OleDb)" , "System.Data.OleDb.OleDbConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.AccessOdbc , "Microsoft Access (ODBC)" , "System.Data.Odbc.OdbcConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.Firebird , "Firebird" , "FirebirdSql.Data.FirebirdClient.FbConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.MySqlConnector, "MySql" , "MySql.Data.MySqlClient.MySqlConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.PostgreSQL , "PostgreSQL" , "Npgsql.NpgsqlConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SybaseManaged , "SAP/Sybase ASE" , "AdoNetCore.AseClient.AseConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SQLiteClassic , "SQLite" , "System.Data.SQLite.SQLiteConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SqlCe , "Microsoft SQL Server Compact" , "System.Data.SqlServerCe.SqlCeConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.DB2LUW , "DB2 for Linux, UNIX and Windows", "IBM.Data.DB2.DB2Connection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.DB2zOS , "DB2 for z/OS" , "IBM.Data.DB2.DB2Connection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.InformixDB2 , "Informix (IDS)" , "IBM.Data.DB2.DB2Connection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SapHanaNative , "SAP HANA (Native)" , "Sap.Data.Hana.HanaConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SapHanaOdbc , "SAP HANA (ODBC)" , "System.Data.Odbc.OdbcConnection"));

AddDataProvider(new DynamicProviderRecord(ProviderName.OracleManaged , "Oracle (Managed)" , "Oracle.ManagedDataAccess.Client.OracleConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.Access , ProviderName.Access , "Microsoft Access (OleDb)" , "System.Data.OleDb.OleDbConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.AccessOdbc , ProviderName.AccessOdbc , "Microsoft Access (ODBC)" , "System.Data.Odbc.OdbcConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.Firebird , ProviderName.Firebird , "Firebird" , "FirebirdSql.Data.FirebirdClient.FbConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.MySqlConnector, ProviderName.MySqlConnector, "MySql" , "MySql.Data.MySqlClient.MySqlConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.PostgreSQL , ProviderName.PostgreSQL , "PostgreSQL" , "Npgsql.NpgsqlConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SybaseManaged , ProviderName.SybaseManaged , "SAP/Sybase ASE" , "AdoNetCore.AseClient.AseConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SQLiteClassic , ProviderName.SQLiteClassic , "SQLite" , "System.Data.SQLite.SQLiteConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SqlCe , ProviderName.SqlCe , "Microsoft SQL Server Compact" , "System.Data.SqlServerCe.SqlCeConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.DB2LUW , ProviderName.DB2LUW , "DB2 for Linux, UNIX and Windows", "IBM.Data.DB2.DB2Connection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.DB2zOS , ProviderName.DB2zOS , "DB2 for z/OS" , "IBM.Data.DB2.DB2Connection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.InformixDB2 , ProviderName.InformixDB2 , "Informix (IDS)" , "IBM.Data.DB2.DB2Connection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SapHanaNative , ProviderName.SapHanaNative , "SAP HANA (Native)" , "Sap.Data.Hana.HanaConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.SapHanaOdbc , ProviderName.SapHanaOdbc , "SAP HANA (ODBC)" , "System.Data.Odbc.OdbcConnection"));
AddDataProvider(new DynamicProviderRecord(ProviderName.OracleManaged , ProviderName.OracleManaged , "Oracle (Managed)" , "Oracle.ManagedDataAccess.Client.OracleConnection"));

// we use System.Data.SqlClient to be able to use Microsoft.SqlServer.Types
AddDataProvider(new DynamicProviderRecord(ProviderName.SqlServer , "Microsoft SQL Server" , "System.Data.SqlClient.SqlConnection"));

//AddDataProvider(
// new DynamicProviderRecord(
// ProviderName.SqlServer,
// "Microsoft SQL Server",
// "System.Data.SqlClient.SqlConnection")
// {
// AdditionalNamespaces = new[] { "Microsoft.SqlServer.Types" },
// ProviderLibraries = "Microsoft.SqlServer.Types.dll"
// });

//AddDataProvider(new DynamicProviderRecord(DB2iSeriesProviderName.DB2, "DB2 iSeries (Requires iAccess 7.1 .NET Provider)", "IBM.Data.DB2.iSeries.iDB2Connection")
//{
// InitializationClassName = "LinqToDB.DataProvider.DB2iSeries.DB2iSeriesTools, LinqToDB.DataProvider.DB2iSeries",
// ProviderLibraries = "LinqToDB.DataProvider.DB2iSeries.dll;IBM.Data.DB2.iSeries.dll"
//});
AddDataProvider(new DynamicProviderRecord(ProviderName.SqlServer , "System.Data.SqlClient" , "Microsoft SQL Server" , "System.Data.SqlClient.SqlConnection"));
}

public class DynamicProviderRecord
{
public string Name { get; }
public string ProviderName { get; }
public string Description { get; }
public string ConnectionTypeName { get; }
public IReadOnlyCollection<string> Libraries { get; }
public string? InitializationClassName { get; set; }
public NamedValue[]? ProviderNamedValues { get; set; }
public string[]? AdditionalNamespaces { get; set; }

public DynamicProviderRecord(string providerName, string description, string connectionTypeName, params string[] providerLibraries)
public DynamicProviderRecord(string name, string providerName, string description, string connectionTypeName, params string[] providerLibraries)
{
Name = name;
ProviderName = providerName;
Description = description;
ConnectionTypeName = connectionTypeName;
Expand Down Expand Up @@ -136,14 +114,6 @@ public void Load(string connectionString)
.Concat(new[] { typeof(DataConnection).Assembly })
.ToArray();


var typeName = Provider.InitializationClassName;
if (!string.IsNullOrEmpty(typeName))
{
var initType = Type.GetType(typeName, true)!;
RuntimeHelpers.RunClassConstructor(initType.TypeHandle);
}

var provider = ProviderHelper.GetDataProvider(Provider.ProviderName, connectionString);

var connectionAssemblies = new List<Assembly>() { provider.GetType().Assembly };
Expand Down
Loading

0 comments on commit 135f9bb

Please sign in to comment.