DbRESTFul 1.0.0

dotnet add package DbRESTFul --version 1.0.0                
NuGet\Install-Package DbRESTFul -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DbRESTFul" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DbRESTFul --version 1.0.0                
#r "nuget: DbRESTFul, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DbRESTFul as a Cake Addin
#addin nuget:?package=DbRESTFul&version=1.0.0

// Install DbRESTFul as a Cake Tool
#tool nuget:?package=DbRESTFul&version=1.0.0                

DbRESTFul

A very lightweight .net core RESTFul api framework to just expose your SQLs to Web Apis easyly.

Key features:

  • Create a Configured Sql Invocation (CSI) definition
{
    "Name": "ListStudents",
    "Module": "epc",
    "Code": "SELECT id, name, age, gender FROM student WHERE age > 10 [AND name LIKE CONCAT('%',@keyword,'%')] LIMIT @pageStart, @pageSize;",
    "ResultSet": "M",
    "QueryOnly": true,
    "RequiredTransaction": false,
    "Middlewares": {
      "pagination": {
        "size": "pageSize",
        "count": "totalCount",
        "page": "pageIndex"
      }
    },
    "Branch": null,
    "Description": "获取学生信息"
  }
  • Then create an Api definition
{
    "Version": "1.0.0",
    "Owner": "Dawson Liu",
    "Name": "ListStudents",
    "Module": "school",
    "Url": "list/students",
    "Method": "get",
    "Title": "获取学生信息",
    "Summary": "获取学生信息",
    "Note": "",
    "AllowAnonymous": false,
    "UseAbsoluteUrl": false,
    "Deprecated": false,
    "Protocol": "httpAndRpc",
    "Cache": {
      "Enabled": false,
      "Type": "redis",
      "Expiration": 300
    },
    "implemented": true,
    "Implementation": {
      "Type": "csi",
      "Name": "ListStudents"
    },
    "Parameter": {
      "Query": [
        {
          "Name": "pageSize",
          "Type": "int",
          "Nullable": false,
          "Description": "页数",
          "SimpleArrayItemType": "string",
          "Schema": null
        },
        {
          "Name": "pageIndex",
          "Type": "int",
          "Nullable": false,
          "Description": "页码",
          "SimpleArrayItemType": "string",
          "Schema": null
        },
        {
          "Name": "age",
          "Type": "int",
          "Nullable": true,
          "Description": "年龄",
          "SimpleArrayItemType": "string",
          "Schema": []
        },
        {
          "Name": "keyword",
          "Type": "string",
          "Nullable": true,
          "Description": "搜索关键词",
          "SimpleArrayItemType": "string",
          "Schema": []
        }
      ]
    },
    "Result": {
      "Type": null,
      "Schema": [
        {
          "Name": "statusCode",
          "Type": "int",
          "Nullable": false,
          "Description": "错误码(默认为200,无错误信息)",
          "SimpleArrayItemType": "string",
          "Schema": null
        },
        {
          "Name": "errorMessage",
          "Type": "string",
          "Nullable": true,
          "Description": "错误信息",
          "SimpleArrayItemType": "string",
          "Schema": null
        },
        {
          "Name": "data",
          "Type": "object",
          "Nullable": true,
          "Description": "返回的数据",
          "SimpleArrayItemType": "string",
          "Schema": [
            {
              "Name": "items",
              "Type": "array",
              "Nullable": true,
              "Description": "当前页数据项目",
              "SimpleArrayItemType": "string",
              "Schema": [
                {
                  "Name": "id",
                  "Type": "int",
                  "Nullable": true,
                  "Description": "",
                  "Schema": null
                },
                {
                  "Name": "name",
                  "Type": "string",
                  "Nullable": true,
                  "Description": "",
                  "Schema": null
                },
                {
                  "Name": "age",
                  "Type": "int",
                  "Nullable": true,
                  "Description": "",
                  "Schema": null
                },
                {
                  "Name": "gender",
                  "Type": "int",
                  "Nullable": true,
                  "Description": "",
                  "Schema": null
                }
              ]
            },
            {
              "Name": "pagination",
              "Type": "object",
              "Nullable": false,
              "Description": "分页信息",
              "SimpleArrayItemType": "string",
              "Schema": [
                {
                  "Name": "totalCount",
                  "Type": "int",
                  "Nullable": false,
                  "Description": "总条数",
                  "SimpleArrayItemType": "string",
                  "Schema": null
                },
                {
                  "Name": "pageSize",
                  "Type": "int",
                  "Nullable": false,
                  "Description": "页数",
                  "SimpleArrayItemType": "string",
                  "Schema": null
                },
                {
                  "Name": "pageIndex",
                  "Type": "int",
                  "Nullable": false,
                  "Description": "页码",
                  "SimpleArrayItemType": "string",
                  "Schema": null
                }
              ]
            }
          ]
        }
      ]
    },
    "Mock": [],
    "CreatedAt": "2024-04-15T15:30:39"
  }
  • Then run the app, your sql will be exposed to an api with name ListStudents, url: http://locahost:8080/api/school/list/students

License

DbRESTFul is open source software, licensed under the terms of MIT license.

Contact

Wechat: Dawsonliu

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 91 4/29/2024