Skip to content

DataService服务

将类方法直接暴漏为外部服务的标签 适用 类与接口 文件

中间件配置

安装包 Infrastructure.DataService

services.AddDataService(options =>
{ 
    options.FormatResult = appConfig.DataService.FormatResult;
    options.FormatResultType = typeof(ResponseOutput<>);

    _hostAppOptions?.ConfigureDataService?.Invoke(options);
});

方法名映射对应方法

  ["add"] = "POST",
           ["create"] = "POST",
           ["insert"] = "POST",
           ["submit"] = "POST",
           ["post"] = "POST",

           ["get"] = "GET",
           ["find"] = "GET",
           ["fetch"] = "GET",
           ["query"] = "GET",

           ["update"] = "PUT",
           ["change"] = "PUT",
           ["put"] = "PUT",
           ["batch"] = "PUT",

           ["delete"] = "DELETE",
           ["soft"] = "DELETE",
           ["remove"] = "DELETE",
           ["clear"] = "DELETE",

接口权限

  • [Login] 登录后可操作
  • [AllowAnonymous] 匿名访问