Closed coolio986 closed 4 months ago
Additional information. Version 4.60 uses Date_Add function correctly for MySql
I have identified the breaking change as commit https://github.com/nopSolutions/nopCommerce/commit/9c176a6c7ac0537d8101e41fd0f45cef1111813a
It appears the mapping schema is missing during the data connection creation. I added
MySqlTools.GetDataProvider(ProviderName.MySqlConnector).MappingSchema
to
NopMappingSchema.cs at GetMappingSchema(string configurationName)
public static MappingSchema GetMappingSchema(string configurationName)
{
if (Singleton<MappingSchema>.Instance is null)
{
Singleton<MappingSchema>.Instance ??= new MappingSchema(configurationName, MySqlTools.GetDataProvider(ProviderName.MySqlConnector).MappingSchema);
Singleton<MappingSchema>.Instance.AddMetadataReader(new FluentMigratorMetadataReader());
}
return Singleton<MappingSchema>.Instance;
}
This is not a very elegant fix, but will suffice until I create a PR
PR created with a more elegant fix https://github.com/nopSolutions/nopCommerce/pull/7134
Closed #7132
nopCommerce version: 4.70
Steps to reproduce the problem:
MySqlConnector.MySqlException (0x80004005): FUNCTION MyNopCommerceDatabase.DateAdd does not exist
Thrown at OrderReportService, SalesSummaryReportAsync await ssReport.ToPagedListAsync(pageIndex, pageSize);
Sql Expression from ssReport:
Of course the expression is much longer, but this illustrates the issue.
In MySql DateAdd is not a function: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html
At this time, I am not sure if this is a LinqToDB issue or some other type of translation issue. I will dive more into the issue and report any results.