zhengkai wang
zhengkai wang

Reputation: 101

How to extend existing entity in ASP.NET Boilerplate?

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?

Upvotes: 0

Views: 1380

Answers (1)

Vivek Nuna
Vivek Nuna

Reputation: 1

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; }

Upvotes: 1

Related Questions