Info
Version: | 1.0.0.143 |
Author(s): | Sun |
Last Update: | Wednesday, July 6, 2022 |
.NET Fiddle: | Create the first Fiddle |
NuGet Url: | https://www.nuget.org/packages/Smart.SWeb |
Install
Install-Package Smart.SWeb
dotnet add package Smart.SWeb
paket add Smart.SWeb
Smart.SWeb Download (Unzip the "nupkg" after downloading)
Dependencies
- Smart.Kernel(>= 1.0.0.104)
- log4net(>= 2.0.8)
- Newtonsoft.Json(>= 9.0.1)
- Microsoft.AspNet.WebApi.Client(>= 5.2.4)
- Microsoft.AspNet.WebApi.Core(>= 5.2.4)
- FluentValidation(>= 8.6.1)
- FluentValidation.ValidatorAttribute(>= 8.6.1)
- FluentValidation.WebApi(>= 8.6.1)
- System.ComponentModel.Annotations(>= 4.4.1)
Tags
使用方法:
(在Global.asax.cs文件Application_Start方法添加如下代码)
//全局封装webapi的返回结果如:{"Code":500,"Data":null,"Message":"尝试除以零。","Success":false}
GlobalConfiguration.Configure(Smart.Web.SmartWeb.InitAPIResultAttribute);
//全局异常处理
GlobalConfiguration.Configure(Smart.Web.SmartWeb.InitApiExceptionHandlingAttribute);
(在WebApiConfig.cs文件Register方法添加如下代码)
//控制器版本管理
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("config", config);
var versionControllerSelector = Smart.Kernel.Resolve<Smart.Web.ISVersionControllerSelector>(dic);
config.Services.Replace(typeof(IHttpControllerSelector), versionControllerSelector);.