Пример #1
0
        static void Main(string[] args)
        {
            IPrintRequester  requester = new PrintRequester();
            ACMEContext      context   = new ACMEContext();
            RequestGenerator generator = new RequestGenerator(context, requester);

            generator.Generate();
        }
Пример #2
0
 public PostcodeService(ACMEContext context, IMemoryCache memoryCache) : base(context, memoryCache)
 {
 }
Пример #3
0
 public CountryService(ACMEContext context, IMemoryCache memoryCache) : base(context, memoryCache)
 {
 }
Пример #4
0
        /*
         * 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;
        }
Пример #5
0
 public SubmitService(ACMEContext context, IMemoryCache memoryCache) : base(context, memoryCache)
 {
 }
Пример #6
0
 public RequestGenerator(ACMEContext context, IPrintRequester printRequester)//Plug DI
 {
     this.context        = context;
     this.printRequester = printRequester;
 }