Open Closed

Share Entity Service #9859


0
lweng567 created

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version? 9.3.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net Core

If issue related with ABP Framework

  • What is ABP Framework version? Zero

If issue is about UI

  • Which theme are you using?
  • What are the theme settings?

I am seeking some advice here. I have an application with many Entities and some of them are shared entities. For example, A Person entity has list of Note entities, and a Business entity also has a list of Note entities. User can create, update or delete ( the usual CRUD) Note for both Person and Business entity. In this situation, i can inject Note repository or Note Manager to PersonAppService and BusinessAppService to do all CRUD operation for Note entity, but I will have to repeat myself in two places. I was thinking of creating a common service for Note entity and inject only the commone service to PersonAppService and BusinessAppService, so I dont need to repeat myself. But then the common service will not be able to extend the BaseAppService and use ObjectMapper etc... Can you please shed some light on what will be the best practice on this?

Laurie


1 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @lweng567

    You can define a new base app service for example BaseNoteAppService and inherit from this one for BusinessAppService and PersonAppService. You also need to inject NoteManager to BaseNoteAppService and implement basic operations in this base app service. In that way, you can use it in any entity which is related to Note.