Skip to content
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

Upload initial version of NHibernate.MySqlConnector #1

Closed
wants to merge 2 commits into from

Conversation

razzmatazz
Copy link

This is in response to nhibernate/nhibernate-core#1375

There are a couple of things that I am not sure what to do about:

  • how to build a nuget package
  • should we provide support for multiple frameworks in .csproj (as it uses .netstandard2.0 now)
  • what version of NHibernate should I reference in .csproj (now it has 5.2.1 specified)

Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • how to build a nuget package

It should be done by the CI. I have enabled AppVeyor. Your PR needs to add an appveyor.yml file to handle the build. You may have a look at this one as an example.

  • should we provide support for multiple frameworks in .csproj (as it uses .netstandard2.0 now)

NHibernate also provides net461 for supporting people with old tooling, and netcoreapp2.0 for supporting some features unavailable in netstandard2.0. There is no need to add netcoreapp2.0 if the project has nothing specific to it to handle. About net461, I think, as you wish.

  • what version of NHibernate should I reference in .csproj (now it has 5.2.1 specified)

Likely you should reference the lowest compatible one, to widen who can use it.


namespace NHibernate.MySqlConector.Driver
{
public class MySqlConnectorDriver : ReflectionBasedDriver, IEmbeddedBatcherFactoryProvider
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a separated assembly, there should be no need to use reflection for resolving the data provider, unkless it is not available as a NuGet package.

If MySqlConnector is available as a NuGet package, better take directly a reference on it, and inherits DriverBase instead of ReflectionBasedDriver.

/// Please check <see href="https://github.com/mysql-net/MySqlConnector">MySqlConnector></see>
/// repository for more information.
/// </para>
/// </remarks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation glitch. It should be aligned with the constructor.

/// <inheritdoc />
public override DateTime MinDate => new DateTime(1000, 1, 1);

System.Type IEmbeddedBatcherFactoryProvider.BatcherFactoryClass => typeof(MySqlClientBatchingBatcherFactory);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using MySqlClientBatchingBatcherFactory does not work when using MySqlConnector. MySqlClientBatchingBatcher creates a MySqlClientSqlCommandSet which uses reflection on the MySql.Data assembly to create a MySqlDataAdapter and that causes an exception.

All three of those classes will need to be recreated to use the MySqlConnector MySqlDataAdapter instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT there's no need for a specialized batcher. Can just use GenericBatchingBatcherFactory here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem that way - I asked the question on the discussion group for NHibernate and it seems the generic batcher is a more recent addition and appears to work find with MySql.

@razzmatazz
Copy link
Author

@danspam that is easily out of my competence level..

/// message "Expected End of data packet" when a select command is prepared.
/// </remarks>
protected override bool SupportsPreparingCommands => false;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MySqlConnector does support preparing commands.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it does yet? mysql-net/MySqlConnector#397

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was implemented in 0.43, see here

@jemiller0
Copy link

Any word on whether support for MySqlConnector will be available any time soon? I want to get rid of Oracle's garbage driver.

@dennis-gr dennis-gr mentioned this pull request Mar 29, 2020
@hazzik
Copy link
Member

hazzik commented Apr 19, 2020

Thanks, I've chosen #2 as it has all issues mentioned here resolved.

@hazzik hazzik closed this Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants