Cleanup netcore21 specific code

This commit is contained in:
nicolas.dorier
2020-01-12 13:30:54 +09:00
parent 9876208b7d
commit 629dfcf152
24 changed files with 9 additions and 144 deletions

View File

@@ -1,11 +1,7 @@
using System;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc;
#if NETCOREAPP21
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
#else
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#endif
namespace BTCPayServer
{
@@ -17,12 +13,8 @@ namespace BTCPayServer
string message,
Controller controller)
{
#if NETCOREAPP21
var key = ExpressionHelper.GetExpressionText(ex);
#else
var provider = (ModelExpressionProvider)controller.HttpContext.RequestServices.GetService(typeof(ModelExpressionProvider));
var key = provider.GetExpressionText(ex);
#endif
controller.ModelState.AddModelError(key, message);
}
}