How to extend existing entity in ASP.NET Boilerplate?

asp.net-boilerplate asp.net-core c# entity-framework-core

Question

I have read the documentation on Extending Non-Abstract Entities, and done that accordingly (inherit the Edition entity). But the Up function in migration class is empty.

MyEdition class is below:

using System;
using System.Collections.Generic;
using System.Text;
using Abp.Application.Editions;

namespace Boilerplate.Editions
{
    public class MyEdition: Edition
    {
        public virtual long Price { get; set; }
    }
}

The migration is automatically generated using Add-Migration command of Entity Framework Core.

My migration is below:

public partial class Added_MyEdition_Entity : Migration
{
    protected override void Up(MigrationBuilder migrationBuilder)
    {

    }

    protected override void Down(MigrationBuilder migrationBuilder)
    {

    }
}

So, how to extend existing entity in ASP.NET Boilerplate?

1
0
4/11/2018 3:35:09 PM

Accepted Answer

DBContext has no idea of this new class so you have to add the below line in you DBContext class.

public virtual DbSet<MyEdition> MyEdition { get; set; }
1
4/11/2018 1:02:53 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow