none
.NET core MVC application - dropdown list items RRS feed

  • Question

  • Hi,

    Currently I am working with an existing .NET core MVC application with Razor views.

    There are a number of views with dropdown lists.

    The way they have implemented populating the drop downs is by having an injected helper service which is injected through the constructor (the service's dependency injection is initiated in startup.cs as a singleton class). The dropdownlist helper class loads all the dropdown items for all the possible dropdown lists in the entire application in it's constructor into local variables. So when the first view invokes the controller which in turn calls this service, all the dropdown values are loaded into the memory on the server.

    This to me looks a bit inefficient and I think each view should trigger loading only the dropdown list items that it needs.

    Can I have some advice on this and advice what would be good practice to load dropdown values?

    Thanks a lot

    Angelo

    • Moved by CoolDadTx Monday, September 24, 2018 2:11 PM ASP.NET related
    Monday, September 24, 2018 9:05 AM

All replies