MySQL connection with Pomelo.EntityFrameworkCore.MySql

1 Answer 628 Views
.NET Core DataSources
Zaw
Top achievements
Rank 1
Veteran
Zaw asked on 05 Aug 2021, 09:45 AM

Hello

My .net core api project use below for MySQL database connection.

<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1" />

I would like to know Telerik Reporting service can work with Pomelo or not?

What providerName should I need to use for connectionString in appsettings?

When I tried, I got below error

Unable to establish a connection to the database. Please verify that your connection string is valid. In case you use a named connection string from the application configuration file, make sure the name is correct and the connection string settings are present in the configuration file of your application.

------------- InnerException -------------

Cannot load assembly by name "MySql.Data".

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 10 Aug 2021, 09:19 AM

Hi Zaw,

Basically, it should not be a problem. Can you please test adding MySql.Data NuGet package to the project? You may also find the Could not load file or assembly 'MySql.Data SO thread.

Regards,
Neli
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Zaw
Top achievements
Rank 1
Veteran
commented on 10 Aug 2021, 09:39 AM

Hello Neli

I can't add MySql.Data in my proj, it results below error. 

The type 'MySqlConnection' exists in both 'MySql.Data, Version=8.0.26.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' and 'MySqlConnector, Version=0.61.0.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92'

I think it will conflict with existing MySql package.   Please note my proj is .Net Core 3.1.

 

Thanks

 

 

Neli
Telerik team
commented on 13 Aug 2021, 11:16 AM

Hi Zaw,

Thank you for the update.

I would recommend testing the approach from the How to register a DbProviderFactory in a .NET Core project KB article.

There is one more thing that I would like to ask you to test. Can you please open the report in the designer and right-click over the SQL DataSoure -> Configure. In step 2, select the "Embedded in the report definition" option. Then run the application again. In this case, we will make sure that the problem does not come from a wrong connection string in the appsettings.json file.

 

Tags
.NET Core DataSources
Asked by
Zaw
Top achievements
Rank 1
Veteran
Answers by
Neli
Telerik team
Share this question
or