-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NH-4008 - Split database providers into own projects. #626
base: master
Are you sure you want to change the base?
Conversation
@ngbrown great work, as usual. |
Shouldn't dialects be in separate packages? |
@hazzik I started that direction, but the only actual dependency was in the xmldoc comments, so that's why I didn't move them at first. I can circle around again and see if it makes sense moving them. Then I can expand the use of configure-by-code to something like |
I also really wanted to rename |
4099f92
to
39a1466
Compare
@hazzik I remember why I didn't pull the dialects into the per-database projects... A major reason was the 5 Oracle dialects have 4 different drivers, and everything mixes and matches... Only one of which is officially available on NuGet; the Oracle.ManagedDataAccess one. Any ideas? |
5c5e6c9
to
47da70e
Compare
8c3815d
to
969deee
Compare
8656d25
to
ededf50
Compare
@hazzik @fredericDelaporte I noticed this isn't marked as going into v5.0.0. I think this is a worthy breaking change and would like to see it merged. The last thing to do is update the NAnt build here to create NuGet packages per driver. If the Support for .NET Core 2.0 pull request (#633) is going to follow quickly it could be deferred to that. Everything done here for NuGet package is thrown away in that pull request, since msbuild is used in #633 and NAnt is used here. |
c715398
to
57fd898
Compare
I've updated the NAnt build to build and publish the NuGet packages. Importing secondary database drivers works even better that I originally hoped, even importing the native drivers for SQLite and SqlServer.Compact. I did rename Once the build is finished, the nuget packages should be published on TeamCity's feed. Can someone try it out? |
About the dialects, due to the Oracle (and Sybase, and potentially Firebird) situation, having many drivers usable for the same database, so many usable drivers for the same dialect, extracting dialect from the main NHibernate project would require to put them in their own dialect projects, letting then the user choosing which drivers and which dialects he wants. (Maybe could we then put a dependency from the driver project to the dialects project, but with the Sybase case, it is not even sure we can.) I do not think it is worth it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the second throw in the ConnectionProvider.ConfigureDriver
should be adjusted for hinting at including relevant Nuget package.
About the Nuget packages, still waiting for the release build (supposed to be triggered by teamcity once per day).
ShowBuildMenu.bat
Outdated
@@ -15,7 +15,7 @@ echo. | |||
echo --- TESTING --- | |||
echo B. (Step 1) Set up a new test configuration for a particular database. | |||
echo C. (Step 2) Activate a test configuration. | |||
echo D. (Step 3) Run tests using active configuration. | |||
echo D. (Step 3) Run tests using active configuration (Build in Visual Studio). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean "Built"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean to run this test step, you have to build in Visual Studio first. Performing the build from the menu outputs to a different location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precisely, I would use "built" for meaning this. It should have already been built in Visual Studio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworded to "Needs built in Visual Studio".
ShowBuildMenu.bat
Outdated
start "nunit3-console" cmd /K %NUNIT% --x86 --agents=1 --process=separate NHibernate.nunit | ||
SET NUNITPLATFORM= | ||
IF /I "%PLATFORM%" NEQ "x64" set NUNITPLATFORM=--x86 | ||
start "nunit3-console" cmd /K %NUNIT% %NUNITPLATFORM% --agents=1 --process=separate NHibernate.nunit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is switching the tests to 64bits related to NH-4008?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just trying to get it to work correctly from a mistake I had made in NH-3900 (update to NUnit 3). There were 64 bit configurations available (SQLite and SqlServer.Compact) that weren't running correctly.
@@ -35,6 +35,8 @@ | |||
<StartProgram>$(MSBuildProjectDirectory)\..\..\Tools\nunit\nunit-x86.exe</StartProgram> | |||
<StartArguments>NHibernate.Test.dll</StartArguments> | |||
<TargetFrameworkProfile /> | |||
<NuGetPackageImportStamp> | |||
</NuGetPackageImportStamp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be an old thing from VS2013.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, but came from VS 2017...
using System.Linq; | ||
|
||
/// <summary> | ||
/// <summary> | ||
/// Represents SQL Server SELECT query parser, primarily intended to support generation of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace miss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
The firebird driver still has a method, |
I have tested with a dummy mvc project, referencing the resulting Nuget packages (from a local repository) for NHibernate and SqlServer. It works. |
@fredericDelaporte using the NuGet packages really shines when it can pull database specific drivers (such as |
We do not actually publish them, so it should not cause issues. Of course for testing with local repositories, this could cause issues. But since only contributors will likely do that, they should be able to fix it. By the way I have not checked how was handled that versioning. I have not yet been involved in Nuget publishing. Alexander knows that subject way better than me. |
@@ -15,7 +15,7 @@ | |||
<property name="format_sql">true</property> | |||
|
|||
<!-- This is the System.Data.dll provider for MSSQL Server --> | |||
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property> | |||
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver, NHibernate.Driver.SqlClient</property> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be NHibernate.Driver.SqlServerDriver, NHibernate.Driver.SqlServer
, shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Fixed. Must not be used for TeamCity builds though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, that is overridden by default values from nhibernate-properties.xml or specific values defined for the build.
I split off some pre-work in #1610 that can be merged quickly. For this pull request I needed to put some more effort into the tests, and was hoping the effort wouldn't be wasted. |
7db26f7
to
820f754
Compare
This pull request is now rebased. The commit, 'In psake.ps1, build and test in one step.' is needed because not every project can (or should) target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NHibernate.sln.DotSettings should be reverted and a condition is lacking in my opinion in NHibernate.Driver.SQLite.csproj.
<Description>Driver for Oracle databases to be used with NHibernate 5.</Description> | ||
<PackageTags>NHibernate; Driver; ODP.Net; Oracle; ADO.Net</PackageTags> | ||
|
||
<TargetFramework>net461</TargetFramework> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For information, a beta version of ODP.Net for .Net Core 2.0 is available apparently since mid-February. But is it worth trying it, since this would also imply investigating testing Oracle at least with Travis?
And their statement of direction also includes:
ODP.NET Core beta requires Microsoft .NET Core 2.0.2 or higher. .NET Core 2.0 added applicationprogramming
interfaces that are required for ODP.NET Core to work properly. The ODP.NET Core
production release may have different minimum .NET Core version requirements than the beta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the beta version of Oracle.ManagedDataAccess
with .NET Core support isn't yet on NuGet, it shouldn't be added. Once it is, then yes, that would be an option.
I addressed the rest of the feedback as well.
</ItemGroup> | ||
|
||
<!-- This next section is in addition to the .target file for project references. --> | ||
<ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be guarded by a Condition="'$(TargetFramework)' == 'net461'"
for consistency?
(SqlServer.Compact is somewhat similar here, but I am not adding a comment in it because it will normally never have a .Net Core version.)
#if NETFX | ||
(OracleDataClientDriverBase)new OracleManagedDriver() | ||
#else | ||
throw new NotImplementedException("OracleManagedDriver") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering why an exception rather than an ignore, but indeed it makes sens. Since by the time this code path ends up actually executed, we should have added a .Net Core managed driver.
src/NHibernate.sln.DotSettings
Outdated
@@ -1,13 +1,16 @@ | |||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | |||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CommonFormatter/ALIGNMENT_TAB_FILL_STYLE/@EntryValue">USE_SPACES</s:String> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last time I have attempted letting this annoying DotSettings recurrent update slip in a PR, I was asked to revert it. Better do the same I think. (I have personally fixed that annoyance by removing write rights on the file... Maybe the old readonly flag would do it too.)
* Revert ReSharper .DotSettings file migrations * Add guard to SQLite driver package.
Can this be in 5.2 then? |
There are several reasons to keep all drivers in this main repository:
|
@ngbrown and @fredericDelaporte , This is excellent feature so individual project can be upgraded without affecting other drivers. Moreover, drivers such as System.DAta.OracleClient could be removed in future. We are eagerly awaiting this feature. What is holding us here? |
Implements
NH-4008#847.This will also be critical in being clear as to what will be supported under .netstandard2.0, and what will not. It will also make it easier to pull all relevant dependencies together with the driver packages depending on both the main NuGet NHibernate package, and the end database NuGet package.
It separates all the implementations of
DriverBase
into separate projects to allow those individual projects to pull in NuGet dependencies. This means thatconnection.driver_class
in configuration files will probably have to be assembly qualified now.I also added
NHibernate.Cfg.Loquacious
helpers to enable quick configuration when using configure-by-code, much like how middleware is added to OWIN in Asp.Net projects.The update matrix looks like this:
connection.driver_class
connection.driver_class
NHibernate.Driver.FirebirdClientDriver
NHibernate.Driver.FirebirdClientDriver, NHibernate.Driver.Firebird
cfg.Connected.ByFirebirdClientDriver()
NHibernate.Driver.SqlClientDriver
NHibernate.Driver.SqlServerDriver, NHibernate.Driver.SqlServer
cfg.Connected.BySqlServerDriver()
NHibernate.Driver.Sql2008ClientDriver
NHibernate.Driver.SqlServer2008Driver, NHibernate.Driver.SqlServer
cfg.Connected.BySqlServer2008Driver()
NHibernate.Driver.MySqlDataDriver
NHibernate.Driver.MySqlDataDriver, NHibernate.Driver.MySql
cfg.Connected.ByMySqlDataDriver()
NHibernate.Driver.NpgsqlDriver
NHibernate.Driver.NpgsqlDriver, NHibernate.Driver.Npgsql
cfg.Connected.ByNpgsqlDriver()
NHibernate.Driver.SQLite20Driver
NHibernate.Driver.SQLiteDriver, NHibernate.Driver.SQLite
cfg.Connected.BySQLiteDriver()
NHibernate.Driver.SqlServerCeDriver
NHibernate.Driver.SqlServerCompactDriver, NHibernate.Driver.SqlServer.Compact
cfg.Connected.BySqlServerCompactDriver()
NHibernate.Driver.OracleManagedDataClientDriver
NHibernate.Driver.OracleManagedDataClientDriver, NHibernate.Driver.Oracle.Managed
cfg.Connected.ByOracleManagedDataClientDriver()
Over time, as more of the underlying official Ado.Net drivers become available on NuGet, they can be moved to their own package.
There are still 14 drivers that don't have official Ado.Net drivers on NuGet, so they will remain as reflection based for now.