Blazor - Service vs Controller RRS feed

  • Question

  • User379720387 posted

    I have watched many different tutorials and I am now confused about the differences between Controller and Service.

    For instance WeatherForecastController and WeatherForecastService.

    Is that just a matter of terminology?

    Sunday, December 20, 2020 4:03 AM

All replies

  • User-2054057000 posted

    Controller and service both are classes. But controller can be accessed by a URL. Service can be there is any type of project but controller can only be there in MVC architecture, it is the backbone of MVC.

    Sunday, December 20, 2020 9:29 AM
  • User-474980206 posted

    Services are objects injected via the services api, typically thru the constructor.  Commonly BI, logging and network apis. Blazor controllers are called by routing requests.

    Tuesday, December 22, 2020 1:02 AM