示例#1
0
		public Task<object> CreateDynamicRegionAsync(ContentTypeBase type, string regionId, bool managerInit = false)
		{
			V_0 = new ContentFactory.u003cu003ec__DisplayClass3_0();
			V_0.regionId = regionId;
			V_1 = ServiceProviderServiceExtensions.CreateScope(this._services);
			try
			{
				V_2 = type.get_Regions().FirstOrDefault<RegionType>(new Func<RegionType, bool>(V_0.u003cCreateDynamicRegionAsyncu003eb__0));
				if (V_2 == null)
				{
					V_3 = null;
				}
				else
				{
					V_3 = this.CreateDynamicRegionAsync(V_1, V_2, true, managerInit);
				}
			}
			finally
			{
				if (V_1 != null)
				{
					V_1.Dispose();
				}
			}
			return V_3;
		}
        public async Task Invoke(HttpContext context, ILoggerFactory loggerFactory)
        {
            do
            {
                try
                {
                    await _next(context);

                    break;
                }
                catch (DbUpdateConcurrencyException)
                {
                    var logger = loggerFactory
                                 .CreateLogger <DbUpdateConcurrencyExceptionHandlingMiddleware>();

                    if (context.Request.Body != null && context.Request.Body.CanSeek)
                    {
                        context.Request.Body.Seek(0, SeekOrigin.Begin);
                    }

                    logger.LogWarning($"Some concurrent query had time to update the state. Retry handling request process for {context.Request.Method} {context.Request.Path}:{context.TraceIdentifier}");

                    // Recreate scope for use new db context
                    context.RequestServices = ServiceProviderServiceExtensions.CreateScope(context.RequestServices).ServiceProvider;

                    continue;
                }
            } while (true);
        }
示例#3
0
        public async Task <IValueProvider> BindAsync(BindingContext context)
        {
            await Task.Yield();

            var scope = InjectBindingProvider.Scopes.GetOrAdd(context.FunctionInstanceId, (_) => ServiceProviderServiceExtensions.CreateScope(_serviceProvider));
            var value = ServiceProviderServiceExtensions.GetRequiredService(scope.ServiceProvider, _type);

            return(await BindAsync(value, context.ValueContext));
        }