请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

JESAI.DynamicWebApi: 此类库是基于netcore 3.1.主要是把一些服务动态创建WebApi ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

JESAI.DynamicWebApi

开源软件地址:

https://gitee.com/Jesai/JESAI.DynamicWebApi

开源软件介绍:

JESAI.DynamicWebApi

Latest version

介绍

此类库是基于netcore 3.1.主要是把一些服务动态创建WebApi。当前的想法是打算后续做一个数据库配置相关的。类库是从ABP分离出来。ABP的代码太重,俨然一个全家桶,想单独拿轮子出来装到自己的车上,还是比较麻烦。特此把他单独分离出来,不受ABP依赖。

安装教程

NugetInstall-Package JESAI.DynamicWebApi

或者在nuget管理器中搜索安装

输入图片说明

使用说明

startup配置

services.AddDynamicWebApi(this.GetType().Assembly);

输入图片说明

代码实现

实现接口IDynamicWebAPiService

标注特性DynamicWebAPi

using JESAI.DynamicWebApi.Attributes;using JESAI.DynamicWebApi.Demo.Dtos;using Microsoft.AspNetCore.Mvc;using System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;namespace JESAI.DynamicWebApi.Demo.Dynamic{    [DynamicWebApi]    public class TestAppService: IDynamicWebApiService    {        private static readonly Dictionary<int, string> Apples = new Dictionary<int, string>()        {            [1] = "Big Apple",            [2] = "Small Apple"        };        /// <summary>        /// Get An Apple.        /// </summary>        /// <param name="id"></param>        /// <returns></returns>        [HttpGet("{id:int}")]        public string Get(int id)        {            if (Apples.ContainsKey(id))            {                return Apples[id];            }            else            {                return "No Apple!";            }        }        /// <summary>        /// Get  All Apple Async.        /// </summary>        /// <returns></returns>        public IEnumerable<string> GetAllAsync()        {            return Apples.Values;        }        /// <summary>        /// Get All Apple.        /// </summary>        /// <returns></returns>        public IEnumerable<string> Get()        {            return Apples.Values;        }        /// <summary>        /// Get All Apple.        /// </summary>        /// <returns></returns>        public IEnumerable<string> GetBigApple()        {            return Apples.Values;        }        public void Update(UpdateAppleDto dto)        {            if (Apples.ContainsKey(dto.Id))            {                Apples[dto.Id] = dto.Name;            }        }        /// <summary>        /// Delete Apple        /// </summary>        /// <param name="id">Apple Id</param>        [HttpDelete("{id:int}")]        public void Delete(int id)        {            if (Apples.ContainsKey(id))            {                Apples.Remove(id);            }        }    }}

参与贡献

####效果展示输入图片说明输入图片说明


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

热门推荐
阅读排行榜
  • ** REJECT ** DO NOT USE THIS CANDIDATE NUMBER. ConsultIDs: none. Reason: This ca

    阅读:234|2022-09-23
  • Simple Task Scheduling System v1.0 was discovered to contain a SQL injection vul

    阅读:207|2022-09-18
  • Simple Task Scheduling System v1.0 was discovered to contain a SQL injection vul

    阅读:218|2022-09-18
  • Novel-Plus v3.6.2 was discovered to contain a hard-coded JWT key located in the

    阅读:224|2022-09-18
  • Novel-Plus v3.6.2 was discovered to contain an arbitrary file download vulnerabi

    阅读:224|2022-09-18
  • Simple Task Scheduling System v1.0 was discovered to contain a SQL injection vul

    阅读:127|2022-09-18
  • An issue was discovered in the Arm Mali GPU Kernel Driver. A non-privileged user

    阅读:246|2022-09-18
  • HashiCorp Boundary up to 0.10.1 did not properly perform data integrity checks t

    阅读:184|2022-09-18
  • In D-Link DIR-816 A2_v1.10CNB04.img a command injection vulnerability occurs in

    阅读:215|2022-09-18
  • D-Link DIR-816 A2_v1.10CNB04.img is vulnerable to Command Injection via /goform/

    阅读:190|2022-09-18

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap