How is layer between MVC controller and back-end called?

by Yeldar Kurmangaliyev   Last Updated November 17, 2017 07:05 AM

I have ASP.NET MVC application with the following controller and action:

public class AccountsController
{
    public ActionResult Index() 
    {
        var accounts = AccountsManager.GetAccounts();
        return View(accounts);
    }
}

and AccountsManager class like this:

public class AccountsManager
{ 
    private static ILogger Logger ...
    private static ICache Cache ...
    private static IAccountsService Service ...
    private static IMapper ViewModelMapper ...

    private const string CacheKey = "Accounts";

    public static AccountViewModel[] LoadAccounts() 
    {
        try 
        {
            if (Redis.TryGet(CacheKey, out var cached))
                return cached;

             var accounts = Service.GetAccounts();
             var vms = ViewModelMapper.Map<AccountViewModel[]>(accounts);

             Redis.Set(CacheKey, vms);
             return vms;
        } 
        catch (Exception ex)
        {
            Logger.Error(ex);
            throw;
        }
    }
}

So, this AccountsManager class removes code duplication and encapsulates the following logic:

  • Communication with back-end
  • Resolving dependencies
  • Caching
  • Logging
  • Error handling
  • ViewModel mapping
  • Request retrying, service auth etc.

However, calling this classes XXXManager makes me feel uncomfortable since this word Manager is ambigious.

How is this layer usually called?



Related Questions


How do I design a Service Layer in code?

Updated July 19, 2016 08:02 AM

Layer Bridging in iOS SDK?

Updated November 01, 2018 10:05 AM

Decouple service complex query building from datastore

Updated January 15, 2018 14:05 PM