Here is my code for creating one table and it's working fine:
using FluentMigrator;
using Nop.Data.Migrations;
using Nop.Plugin.Misc.BoxPacking.Domains;
namespace Nop.Plugin.Misc.BoxPacking.Data
{
[SkipMigrationOnUpdate]
[NopMigration("2020/05/27 08:40:55:1687541", "Other.Boxes base schema")]
public class SchemaMigration : AutoReversingMigration
{
protected IMigrationManager _migrationManager;
public SchemaMigration(IMigrationManager migrationManager)
{
_migrationManager = migrationManager;
}
public override void Up()
{
_migrationManager.BuildTable<OrderBoxes>(Create);
}
}
}
using Microsoft.Extensions.DependencyInjection;
using Nop.Core.Configuration;
using Nop.Core.Infrastructure;
using Nop.Core.Infrastructure.DependencyManagement;
using Nop.Plugin.Misc.BoxPacking.Services;
namespace Nop.Plugin.Misc.BoxPacking.Infrastructure
{
/// <summary>
/// Dependency registrar
/// </summary>
public class DependencyRegistrar : IDependencyRegistrar
{
/// <summary>
/// Register services and interfaces
/// </summary>
/// <param name="services">Collection of service descriptors</param>
/// <param name="typeFinder">Type finder</param>
/// <param name="appSettings">App settings</param>
public virtual void Register(IServiceCollection services, ITypeFinder typeFinder, AppSettings appSettings)
{
services.AddScoped<IOrderBoxesServices, OrderBoxesServices>();
}
/// <summary>
/// Order of this dependency registrar implementation
/// </summary>
public int Order => 1;
}
}
Here is my code for creating multiple tables which is not working:
using FluentMigrator;
using Nop.Data.Migrations;
using Nop.Plugin.Misc.BoxPacking.Domains;
namespace Nop.Plugin.Misc.BoxPacking.Data
{
[SkipMigrationOnUpdate]
[NopMigration("2020/05/27 08:40:55:1687541", "Other.Boxes base schema")]
public class SchemaMigration : AutoReversingMigration
{
protected IMigrationManager _migrationManager;
public SchemaMigration(IMigrationManager migrationManager)
{
_migrationManager = migrationManager;
}
public override void Up()
{
_migrationManager.BuildTable<OrderBoxes>(Create);
_migrationManager.BuildTable<Boxes>(Create);
}
}
}
using Microsoft.Extensions.DependencyInjection;
using Nop.Core.Configuration;
using Nop.Core.Infrastructure;
using Nop.Core.Infrastructure.DependencyManagement;
using Nop.Plugin.Misc.BoxPacking.Services;
namespace Nop.Plugin.Misc.BoxPacking.Infrastructure
{
/// <summary>
/// Dependency registrar
/// </summary>
public class DependencyRegistrar : IDependencyRegistrar
{
/// <summary>
/// Register services and interfaces
/// </summary>
/// <param name="services">Collection of service descriptors</param>
/// <param name="typeFinder">Type finder</param>
/// <param name="appSettings">App settings</param>
public virtual void Register(IServiceCollection services, ITypeFinder typeFinder, AppSettings appSettings)
{
services.AddScoped<IOrderBoxesServices, OrderBoxesServices>();
services.AddScoped<IBoxesServices, BoxesServices>();
}
/// <summary>
/// Order of this dependency registrar implementation
/// </summary>
public int Order => 1;
}
}