Custom name for database table

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
How to use custom name for database table from plugin in nopCommerce 4.3?
3 years ago
Tmistry wrote:
How to use custom name for database table from plugin in nopCommerce 4.3?


Please refer
https://www.nopcommerce.com/en/boards/topic/80146/nopcommerce-430-beta-released-please-share-your-impressions/page/5

and refer below posts
https://www.nopcommerce.com/boards/topic/80047/nopcommerce-430-bug-fixes-and-improvements

and

https://github.com/nopSolutions/nopCommerce/commit/96e74973cd4300df5459af160640221240d31faf

you need to use INameCompatibility for your custom table name.
3 years ago
I.e.  Add a new class to project:

using Nop.Data.Mapping;
using Nop.Plugin.YourPluginDomain;
using System;
using System.Collections.Generic;

namespace Nop.Plugin.YourPlugin.Data
{
    public partial class BaseNameCompatibility : INameCompatibility
    {
        public Dictionary<Type, string> TableNames => new Dictionary<Type, string>
        {
            { typeof(YourPluginRecord), "YourNewTableName" },
        };

        public Dictionary<(Type, string), string> ColumnName => new Dictionary<(Type, string), string>
        {
        };
    }
}
3 years ago
It is working!
Thank You!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.