Targetting .net core 2 (aka .net core 2 running on .net core 2)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
I have been experimenting with switching nopCommerce from targeting .net frame 4.6.1
to netcoreapp2.0

There has been some unexpected surprises along the way but I do have a reasonably working version currently.
I am willing to do a pull request on GitHub but I think with the beta so close it's probably not the time for such a major change in the backend

Some notes though:
1. Entity Framework Core
- Redo the mapping classes. The instructions now go in the OnConfigure method not constructor
- Many to many relationships can be done however they need to be explicitly defined and configured
- Any usage of the many to many has to work on the join entity
- Surprisingly lazy loading is not as much of an issue as expected. So far just mostly related to PermissionRecord, product attributes and specifications, and Address. Otherwise most of everything else (tested so far) is working
- Sql Server Compact Edition does not work in .net core 2
- Have added SQLite (with MySQL and PostgreSQL to come)

2. Incompatible references
- ImageResizer depends on Bitmap which is only available on full .net. SixLabors.ImageSharp looks like a good replacement

3. Other gotchas
- File paths. Must use unix style paths. Windows will work with both Win32 and unix style paths (including combination in one path) but unix will throw an error if Win32 paths are used
- File/Folder naming. Unix is case sensitive so incorrect case may cause problems. Example: Check HomePagePolls folder (for the Component) and where it is called in the cshtml file. It has different case

4. Todo
- Find any further lazy loading issues
- Add MySQL and PostgreSQL support
- Docker support (currently very experimental)

5. Known issues
- Tasks can throw an error sometimes
    -- A second operation started on this context before a previous operation completed
    -- Perhaps just limitation of SQLite and sql server will manage
- Pdf generation
  -- GetFont doesn't work. Haven't investigated properly yet
- Docker throws an error during startup
  -- Attempted to read or write protected memory. This is often an indication that other memory is corrupt
  -- Breakpoint is on the constructor of AdminMapperConfiguration
- Some plugins don't compile yet, some do

Below is running under Ubuntu Bash for Windows



6 years ago
Hi Chris,

Thanks a lot for so detailed post. We've also played with it. Briefly saying the limited functionality of Entity Framework Core is the main reason why we have to stay with .NET Framework now. The work item is here

Chris25 wrote:
I am willing to do a pull request on GitHub

Please do it! It'll definitely be very helpful for us!!!
6 years ago
Sure. Will do a pull request sometime this weekend. Currently everything is unsaved modifications in the working tree so needs some work to put in its own branch
6 years ago
Pull Request 2636 is now created.

The branch I'm working on is at https://github.com/ChrisJollyAU/nopCommerce/tree/target-net-core-2 and I do try and merge the upstream changes every couple of days

Since the last post I have added the MySQL and PostgreSQL providers although have not tested them yet
6 years ago
Thanks Chris, I tested the mysql connector, There is currently an issue with Oracle's MySQL connector and .NET Core 2.0. You may receive an error stating: System.TypeLoadException occurred HResult=0x80131522 Message=Method 'Clone' in type.
6 years ago
Hi

At the time Oracle only had a pre-release version around. They have subsequently released a version that is compatible with .Net Core 2 and .Net Standard 2 however it still has some issues. Namely it has no idea how to deal with GUID c# types and mapping to the database column type.

The third party Pomelo provider works fine so have switched to that. I have currently tested the install and basic product browsing and it is currently working.

The installer currently only configures it to NOT use SSL although if you modify the connection string in datasettings.json it will probably work
6 years ago
Updated the branch to use .net core 2.1 preview1

Have enabled the following new features

- Sockets
- Hsts/https redirection
- Lazy loading

The MySQL provider won't work as there is no updated version available for .net core 2.1 preview1
5 years ago
Hi a.m.

Was busy updating the branch I have on the pull request to the stable .net core 2.1 and noticed that you have already implemented some of the changes independently (and more to come I assume).

Is it worth it me keeping the branch updated?

Also while I'm at it are you looking at adding support for SQLite database? In that case you would need to add the code for sql ce back in. More specifically the code related to supporting database that do not have support for stored procedures

Even though you haven't merged the pull request, I hope it managaged to help some
5 years ago
Hi Chris,

Thanks a lot for your contribution. Right, we've finished the migration. There's no need to support the brach but please do not delete it now. It could be helpful in the future.

We plan to add new databases support in 4.20 (not in 4.10)
5 years ago
Hi a.m.

When do you planning to release version 4.20 and would this version run in linux os?

Thanks.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.