Core WebMEthod and static variables

  • Thread starter Thread starter want 2 Learn
  • Start date Start date
W

want 2 Learn

Guest
I have a method :

public class ApiService : IApiService
{
#region Variables
private readonly ICommonService _commonService;
private readonly IRepository<DirectAccounts> _directAccountsRepository;
private readonly IRepository<Lu_LogStatus> _lu_LogStatusRepository;
private readonly Dictionary<int, string> LogStatus;
#endregion

#region Constructor
public ApiService(IRepository<Lu_LogStatus> lu_LogStatusRepository, ICommonService commonService)
{
_commonService = commonService;
_lu_LogStatusRepository = lu_LogStatusRepository;
LogStatus = _lu_LogStatusRepository.GetAll().ToDictionary(x => x.Id, x => x.Status);
}
}

i want to make the LogStatus static so it will be init only once (since its a db call)

what is the correct wa to do it?

Continue reading...
 
Back
Top