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

The Provider could not be resolved. You must explicitly set the Provider. #67

Closed
CRC32EX opened this issue Aug 6, 2020 · 3 comments
Closed
Assignees

Comments

@CRC32EX
Copy link

CRC32EX commented Aug 6, 2020

Steps to reproduce this issue

  1. Write code

Test.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MySqlConnector" Version="1.0.0" />
    <PackageReference Include="Z.Dapper.Plus" Version="3.0.17" />
  </ItemGroup>

</Project>

Program.cs

using MySqlConnector;
using Z.Dapper.Plus;
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Collections.Generic;

namespace DapperPlusTest
{
  [Table("users")]
  class User
  {
    [Column("id")]
    public ulong Id { get; set; }

    [Column("name")]
    public string Name { get; set; }
  }

  class Program
  {
    const string Connstr = "userid=root;password=MYPASSWORD;database=MYDB;Host=127.0.0.1;";

    static MySqlConnection Connect()
    {
      var conn = new MySqlConnection(Connstr);
      conn.Open();
      return conn;
    }

    static void Main()
    {
      using var conn = Connect();

      var users = new List<User>
      {
        new User{ Id = 1, Name = "name001" },
        new User{ Id = 2, Name = "name002" },
        new User{ Id = 3, Name = "name003" },
      };

      conn.BulkInsert(users);
    }
  }
}
  1. Run
dotnet run
  1. Got error
Unhandled exception. System.Exception: The Provider could not be resolved. You must explicitly set the Provider.
   at Z.BulkOperations.BulkOperation.()
   at Z.BulkOperations.BulkOperation.Execute()
   at Z.BulkOperations.BulkOperation.BulkInsert()
   at Z.Dapper.Plus.DapperPlusAction.Execute()
   at Z.Dapper.Plus.DapperPlusActionSet`1.AddAction(String mapperKey, DapperPlusActionKind actionKind, TEntity item)
   at Z.Dapper.Plus.DapperPlusActionSet`1.DapperPlusActionSetBuilder(DapperPlusContext context, IDbConnection connection, IDbTransaction transaction, String mapperKey, DapperPlusActionKind actionKind, TEntity item, Func`2[] selectors)
   at Z.Dapper.Plus.DapperPlusActionSet`1..ctor(DapperPlusContext context, IDbConnection connection, String mapperKey, DapperPlusActionKind actionKind, TEntity item, Func`2[] selectors)
   at Z.Dapper.Plus.DapperPlusExtensions.BulkInsert[T](IDbConnection connection, String mapperKey, T item, Func`2[] selectors)
   at Z.Dapper.Plus.DapperPlusExtensions.BulkInsert[T](IDbConnection connection, T item, Func`2[] selectors)
   at DapperPlusTest.Program.Main() in D:\Programs\VC\DapperPlusTest\DapperPlusTest\Program.cs:line 41

Possible solution

Use MySqlConnector 0.69.8 instead of MySqlConnector 1.0.0

My Environment

OS Windows 10 Pro 2004 64bit
dotnet 3.1.302
MariaDB 10.2.12-MariaDB
@JonathanMagnan JonathanMagnan self-assigned this Aug 6, 2020
@JonathanMagnan
Copy link
Member

Hello @CRC32EX ,

We do not support yet MySqlConnector, that's why this error is thrown, We currently support MySql.Data and DevArt,

We will try to look to support it next week to see if that's possible or not.

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @CRC32EX ,

The v3.0.18 has been released.

Could you try it and let us know if everything is working with MySqlConnector? We made our test with v1.0.0 but since we have no reference it should not matter.

@CRC32EX
Copy link
Author

CRC32EX commented Aug 12, 2020

Everything works well.
Thank you😊

@CRC32EX CRC32EX closed this as completed Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants