修正名称的错误

This commit is contained in:
admin
2021-01-28 10:10:32 +08:00
parent 72c0e2e8c8
commit 2f12959be0
24 changed files with 147 additions and 122 deletions

View File

@@ -17,21 +17,21 @@ using System.Web.Http.Filters;
namespace NX.ERP.WebAPi
{
//public class JsonContentNegotiator : IContentNegotiator
//{
// private readonly JsonMediaTypeFormatter _jsonFormatter;
public class JsonContentNegotiator : IContentNegotiator
{
private readonly JsonMediaTypeFormatter _jsonFormatter;
// public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
// {
// _jsonFormatter = formatter;
// }
public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
{
_jsonFormatter = formatter;
}
// public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
// {
// var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
// return result;
// }
//}
public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
{
var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
return result;
}
}
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
@@ -45,6 +45,8 @@ namespace NX.ERP.WebAPi
NX.ERP.U8.U8LoginContext.Instance.Server= System.Configuration.ConfigurationManager.AppSettings["Server"];
//optional: set serializer settings here
//System.Web.Http.Filters.IExceptionFilter
config.Filters.Add(new ExceptionFilter());
config.Filters.Add(new ApiResultAttribute());