aspnetcore/src/Microsoft.AspNetCore.Mvc.Core/Internal/PlaceholderBinder.cs

23 lines
874 B
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Microsoft.AspNetCore.Mvc.Internal
{
// Used as a placeholder to break cycles while building a tree of model binders in ModelBinderFactory.
//
// When a cycle is detected by a call to Create(...), we create an instance of this class and return it
// to break the cycle. Later when the 'real' binder is created we set Inner to point to that.
public class PlaceholderBinder : IModelBinder
{
public IModelBinder Inner { get; set; }
public Task BindModelAsync(ModelBindingContext bindingContext)
{
return Inner.BindModelAsync(bindingContext);
}
}
}