Exemple #1
0
 public static void EnsureSingletonLoaded()
 {
     if (_sMiddleTier == null)
     {
         lock (SMiddleTierMutex)
         {
             if (_sMiddleTier == null)
             {
                 var mt = new MiddleTier();
                 _sMiddleTier = mt;
             }
         }
     }
 }
Exemple #2
0
        public static MiddleTier GetMiddleTier(HttpContextBase context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            MiddleTier mt = (MiddleTier)context.Application[MIDDLE_TIER_KEY];

            if (mt == null)
            {
                context.Application.Lock();
                mt = (MiddleTier)context.Application[MIDDLE_TIER_KEY];
                if (mt == null)
                {
                    mt = new MiddleTier();
                    context.Application.Add(MIDDLE_TIER_KEY, mt);
                }
                context.Application.UnLock();
            }
            return(mt);
        }
 /// <inheritdoc />
 /// <summary>
 /// </summary>
 /// <param name="requestContext"></param>
 protected override void Initialize(RequestContext requestContext)
 {
     base.Initialize(requestContext);
     MiddleTier = WebUtilities.GetMiddleTier(HttpContext);
 }
 /// <inheritdoc />
 /// <summary>
 /// ctor.
 /// </summary>
 public AppController()
 {
     MiddleTier = MiddleTier.Instance;
 }