nopCommerce 4.30 - Bug fixes and improvements

5 months ago
Hi nopCommerce team/community,

We are once again very excited about the upcoming version of nopCommerce 4.30 - moving to .NET Core 3.1 and moving away from EF.

What we have seen so from nopCommerce 4.30 has really impressed us. There is a huge performance improvement in nopCommerce 4.30.

We would like to congratulate the whole nopCommerce team for their great job!!!

But with every new release there are issues that need to be addressed before the actual release.
That is why we would like to open this thread (similar to the ones for previous releases) to keep all our feedback for nopCommerce 4.30 in one place.
So we will post anything we find as a bug, could be improved or is still missing in nopCommerce 4.30 in this thread in a separate post.

Important: We would like to keep this thread strictly related to development issues/suggestions so please don't write with any suggestions for new features etc. as it makes it harder for the nopCommerce team to follow and take appropriate actions.

Keep up the good work guys!

We are sure that this release will rock!

Thanks,
Boyko
5 months ago
Thanks a lot, Boyko! Very good suggestion!

Especially I would like to focus testing efforts on the task related to moving away from EF because it caused really a lot of changes
5 months ago
Hi Andrei,

Sure, we also want to test this really well and especially the new MySQL support.
But we just started with the upgrade so we will send you our feedback as soon as we get to the database changes in more detail.

What I noticed so far is that the Miniprofiler does not show the DB queries any more.
It would be great if you add this as it helps us a lot when profiling any performance issues in nopCommerce for our clients.
The code below worked for me in the MsSqlNopDataProvider:

public override IDbConnection CreateDbConnection(string connectionString = null)
        {
            LinqToDB.Common.Configuration.AvoidSpecificDataProviderAPI = true;
            var sqlConnection = new SqlConnection(!string.IsNullOrEmpty(connectionString) ? connectionString : CurrentConnectionString);
            return new StackExchange.Profiling.Data.ProfiledDbConnection(sqlConnection, MiniProfiler.Current);
        }


But I guess this adds some overhead to the performance so this should be configurable (maybe enable only when Miniprofiler is enabled).

Many thanks,
Boyko
5 months ago
Hi guys,

The current implementation of the migrations/builders does not allow us to use custom names for our database tables.
For example we have an entity called "Slider" but the  table in the database is  "SS_Slider".
Unfortunately we can't continue with the upgrade as every single table in our plugins has a custom name (we prefix them with SS_ so that there are no conflicts with other plugins).
The easiest solution I see is to simply set the TableName property of the NopEntityBuilder as we inherit it anyway for each entity.

But right now there are 2 issues with that:

1. It seems that this property is not used at the moment. I think you should use it in the BuildTable method of the MigrationManager .

2. It needs to be virtual so that we can override it.

Thank you in advance!

Boyko
5 months ago
Nop-Templates.com wrote:
...the Miniprofiler does not show the DB queries any more...

Thanks a lot for reporting. Here is a work item
5 months ago
Hi Boyko. Thank you, we created this ticket and will fix this problem soon

Nop-Templates.com wrote:
Hi guys,

The current implementation of the migrations/builders does not allow us to use custom names for our database tables...
5 months ago
Hi guys,

Currently it is not possible to uninstall a plugin that has tables with foreign keys.
There is something wrong in the way the names of the foreign keys are generated during Up and Downs of the migrations.
We use AutoReversingMigration and we create two tables - Slider and SliderImage.
SliderImage table has a foreign key to the Slider table that we have defined like this:

table.WithColumn(nameof(SliderImage.SliderId)).AsInt32().ForeignKey<Slider>();


But when we try to uninstall the plugin it fails with the following error:

FluentMigrator.Runner.MigrationRunner: Error: An error occured executing the following sql:
ALTER TABLE [dbo].[SliderImage] DROP CONSTRAINT [FK_SliderImage_SliderId_Slider_Id]
The error was 'FK_SliderImage_SliderId_Slider_Id' is not a constraint.
Could not drop constraint. See previous errors.


Basically it searches for the wrong foreign key name [FK_SliderImage_SliderId_Slider_Id] , while the name of the key is [FK_SliderImage_SliderId_SliderId].
The difference in at the end Slider_Id vs SliderId.
So during install/up it simply appends the name of property to the primary table name i.e SliderId but during uninstall/down it adds "_" between them i.e Slider_Id.

Since I am not sure which one you have intended to be the correct one I will leave this to you to implement the proper fix.

Thanks,
Boyko
5 months ago
Nop-Templates.com wrote:
Currently it is not possible to uninstall a plugin that has tables with foreign keys....

Thanks a lot, Boyko! We'll check it - https://github.com/nopSolutions/nopCommerce/issues/4372
5 months ago
We fixed the problem, with the naming of tables, please see this ticket for more details.

In general, you need to implement the INameCompatibility interface(see BaseNameCompatibility class for example)


Sergei-k wrote:
Hi Boyko. Thank you, we created this ticket and will fix this problem soon

Hi guys,

The current implementation of the migrations/builders does not allow us to use custom names for our database tables...
5 months ago
Sergei-k wrote:
We fixed the problem, with the naming of tables, please see this ticket for more details.

In general, you need to implement the INameCompatibility interface(see BaseNameCompatibility class for example)


Hi Sergei,

Perfect! It works like a charm!

Thank you for the quick fix!

Thanks,
Boyko