EDP .Net开发框架--WebApi

平台下载地址:https://gitee.com/alwaysinsist/edp


按分类管理EDP所提供的WebApi接口,以供其他应用调用。WebApi接口不仅可以进行访问控制管理,同时还提供了版本管理,同一WebApi接口支持多个不同版本以满足接口调用方的多版本支持。

WebApi接口的数据是通过调用业务方法来获取的,而业务方法是基于业务对象的,因此WebApi获取的数据行、列同样是受权限管控的。

WebApi开发

public class StudentAPI : WebApiBase
继承基类WebApiBase

定义接口方法

点击查看代码
/// <summary>
/// 保存学生信息
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
public ResultModel<bool> SaveStudent(StudentSaveModel param) {
    StudentModel item = new StudentModel();
    param.CopyTo(item);
    return this.bll_Student.SaveStudent(item.ID, item);
}
StudentSaveModel为定义的输入参DTO

WebApi管理

WebApi分类

image

WebApi

  • 新增WebApi接口
    image
    image

    选择程序集后,接口类中会列出所选程序集中包含接口方法的类,选择类后会列出该接口类下所有的接口方法以供选择。
    image

  • 编辑WebApi接口
    image

    在编辑WebApi接口的界面会显示接口的基本信息,以及列出该接口的所有版本。同时提供接口版本的管理功能,如下图:新增接口版本。
    image

WebApi调试与使用

  • WebApi调试
    image

    接口参数描述
    image

    接口调用结果显示
    image

  • WebApi使用
    在这里介绍一下第三方的接口调用,以Psotman为例。

    登录接口请求
    image
    image

    登录接口请求返回结果
    image

    业务接口请求
    image
    image

    业务接口请求返回结果
    image

posted @ 2024-05-20 21:21  風輕·雲淡  阅读(211)  评论(0编辑  收藏  举报