Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Extending existing entities #3074


User avatar
0
bilalhaidar created

Hello I'm reading something in a document on extending existing entities and objects. It says since Tenant, User, and Role are abstract classes we can add new properties on them. While other classes like Edition it's not abstract then we need to create a new class and inherit from Edition class.

Any is that? Maybe something is missing in here. I'm not getting it.


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Actually it means like this. Since AbpTenant class is abstract, we are crated a new class called Tenant in AspNet Zero project, see <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.Core/MultiTenancy/Tenant.cs">https://github.com/aspnetzero/aspnet-ze ... /Tenant.cs</a>.

    So you can directly add your new fields in this class but for other classes like Edition, you need to create a new entity in AspNet Zero to add new fields.

  • User Avatar
    0
    bilalhaidar created

    Thanks for the explanation but still I don't understand why can't I add properties to Edition class directly?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Because this class is defined in Abp.Zero.Common nuget package.

  • User Avatar
    0
    bilalhaidar created

    Can you explain more pls :-)

  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    This is a software design process with EF. Following articles could help to understand. <a class="postlink" href="https://weblogs.asp.net/manavi/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-1-table-per-hierarchy-tph">https://weblogs.asp.net/manavi/inherita ... rarchy-tph</a>

  • User Avatar
    0
    bilalhaidar created

    Thanks I'll read on.