Base solution for your next web application
Open Closed

Consume Service in Dashboard (Dependency Injection) #9670


User avatar
0
HCCNOV created

Version 8.1 Core MVC/JQuery

Is there an example for extending the TenantDashboardAppService so that I can call a Service within Asp.Net Zero (that i created) to generate/return data for the widget? All examples I have found rely solely on GetMemberActivityOutput or DashboardRandomDataGenerator.

I went ahead and crearted a constructor for TenantDashboardAppService and injected my service. This works but want to make sure this is the correct pattern.


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

    Hi @HCCNOV

    You can directly inject services to TenantDashboardAppService but we suggest to create separate services and use them directly in the related widget's JS file.

  • User Avatar
    0
    HCCNOV created

    Perfect. I have moved my data request inside the JS file to point to a separate service. Thank you for the guidance.