Open Closed

Adding navigational properties to non-abstract entities #1129


0
easyest created

Could You please point me to the right direction on how to add navigational properties to non-abstract entities, for example organization unit? If I would like to show the count of shops in this organization unit, it would be easiest to count it's ICollection<Shop> navigational property?


3 Answer(s)
  • 0
    hikalkan created
    Support Team

    Have you checked this document: <a class="postlink" href="http://www.aspnetzero.com/Documents/Extending-Existing-Entities#extending-non-abstract-entities">http://www.aspnetzero.com/Documents/Ext ... t-entities</a> You can add navigation properties just like other properties.

  • 0
    easyest created

    Please excuse me, I may have asked wrong question. The question would be - how to extend organization unit entity? I can extend it as I want, but will OrganizationUnitManager use it? I can extend Tenant, because AbpTenantManager takes class as parameter, but this is not the case with OrganizationUnit , Edition, Language, LanguageText, Notification. So my question is how to extend those?

  • 0
    hikalkan created
    Support Team

    Hi,

    It's actually same as Edition explained here (#1129). Yes, OU manager will work with base class, but it's not a problem. It accepts your derived entitiy. Also, you can cast it whenever you need (Like we did UpdateEditionAsync in the sample code: <a class="postlink" href="http://www.aspnetzero.com/Documents/Extending-Existing-Entities#add-price-on-edition-createupdate">http://www.aspnetzero.com/Documents/Ext ... eateupdate</a>).