re: Clean Architecture Essentials VIEW POST


Hi Ivan, Thanks for share.

What about if we need to obtain all registers from a entity (GetAllEntityXBySomeProperty) to load a DropDownList ? We need to create a UseCase for it, right? Or we just call to the EntityXRepository (GetAllEntityXBySomeProperty method) from the UI ...
Let me shared a personal code:

public class GetAllPropertyTypesByPropertyAgencyUseCase : 
          private readonly IPropertyTypeRepository _propertyTypeRepository;

          public GetAllPropertyTypesByPropertyAgencyUseCase(IPropertyTypeRepository 
             _propertyTypeRepository = propertyTypeRepository;

           public void Execute(GetAllPropertyTypesByPropertyAgencyUseCaseRequest useCaseRequest, 
           IOutputPort<GetAllPropertyTypesByPropertyAgencyUseCaseResponse> outputPort)
              IEnumerable<PropertyType> propertyTypes = 

               if (propertyTypes == default(IEnumerable<PropertyType>))
                  outputPort.HandleError(new List<UseCaseError> { new UseCaseError(1, $" 
                  {nameof(_propertyTypeRepository.GetAllByPropertyAgency)} Not Found") });

                 var getAllByPropertyAgencyPropertyTypeUseCaseResponse = new 


Hey Darian,

Yes, for each interaction you need to create an use case. I implemented an use case similar to yours on Manga Project github.com/ivanpaulovich/clean-arc.... Checkout the branch "React" for the most up to date code.

BTW your use case implementation is missing a return after outputPort.HandleError. Let me know if you have more questions :)

code of conduct - report abuse