public static bool TryGet(out SaasApplicationContext saasApplicationContext)
        {
            if (AsyncStorage.Value != null)
            {
                saasApplicationContext = AsyncStorage.Value;
                return(true);
            }

            saasApplicationContext = null;
            return(false);
        }
        public async Task Invoke(
            HttpContext context
            )
        {
            if (_applicationResolver.TryResolveApplication(context, out var application))
            {
                var pipeline = _requestDelegateMap.GetOrAdd(
                    application.Id,
                    s => _tenantPipelineBuilder.BuildTenancyChain(application)
                    );

                var applicationContext = new SaasApplicationContext(application);
                SaasApplicationContextStore.Store(applicationContext);

                await pipeline.RequestDelegate(context);
            }
            else
            {
                await _next(context);
            }
        }
 public static void Store(
     SaasApplicationContext saasApplicationContext
     )
 {
     AsyncStorage.Value = saasApplicationContext;
 }