static void Main(string[] args) { IPrintRequester requester = new PrintRequester(); ACMEContext context = new ACMEContext(); RequestGenerator generator = new RequestGenerator(context, requester); generator.Generate(); }
public PostcodeService(ACMEContext context, IMemoryCache memoryCache) : base(context, memoryCache) { }
public CountryService(ACMEContext context, IMemoryCache memoryCache) : base(context, memoryCache) { }
/* * The injected "IMemoryCache memoryCache" is singleton and there will be the cases where more than 1 requests * are trying to access same "IMemoryCache memoryCache" object as it's singleton. But The default MS-provided MemoryCache * is entirely thread safe. Any custom implementation that derives from MemoryCache may not be thread safe. As I'm using * the MemoryCache out of the box, it is "FULLY" thread safe. So, there is no need to use * sync lock mechanism "lock(obj)" here to access MemoryCache! * * But to protect unnecessary DB calls when the cache is empty or expired and multiple threads are trying to * access API at the same time, I am only allowing the first call to trigger the DB call to using the synclock * mechanism "lock (lockDbCall)". */ public BaseService(ACMEContext context, IMemoryCache memoryCache) { this.memoryCache = memoryCache; this.context = context; }
public SubmitService(ACMEContext context, IMemoryCache memoryCache) : base(context, memoryCache) { }
public RequestGenerator(ACMEContext context, IPrintRequester printRequester)//Plug DI { this.context = context; this.printRequester = printRequester; }