NetPro.Web.Api 6.0.5-beta.3

This is a prerelease version of NetPro.Web.Api.
There is a newer version of this package available.
See the version list below for details.
dotnet add package NetPro.Web.Api --version 6.0.5-beta.3                
NuGet\Install-Package NetPro.Web.Api -Version 6.0.5-beta.3                
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="NetPro.Web.Api" Version="6.0.5-beta.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetPro.Web.Api --version 6.0.5-beta.3                
#r "nuget: NetPro.Web.Api, 6.0.5-beta.3"                
#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 NetPro.Web.Api as a Cake Addin
#addin nuget:?package=NetPro.Web.Api&version=6.0.5-beta.3&prerelease

// Install NetPro.Web.Api as a Cake Tool
#tool nuget:?package=NetPro.Web.Api&version=6.0.5-beta.3&prerelease                

NetPro.Web.Api使用

NuGet

封装了基本asp.netcore webapi工程需要的基本功能

安装

  • Package Manager方式: Install-Package NetPro.Web.Api -Version 3.1.2

  • .NET CLI 方式: dotnet add package NetPro.Web.Api --version 3.1.2

  • PackageReference: <PackageReference Include="NetPro.Web.Api" Version="3.1.2" />

  • .NET CLI 方式: paket add NetPro.Web.Api --version 3.1.2


支持以下几种开发方式

1、简化版

API主程序集下每个业务模块一个文件夹隔离,业务模块下包含此业务模块的Controller、Service、Entity等等

2、程序集隔离

每个业务模块一个程序集,每个程序集中包含当前业务模块需要的所有Controller、Service、Entity等等,再API主程序集引用需要的业务模块,业务模块之间尽可能不互相依赖,引用。

3、插件方式

2、程序集隔离的基础上,API主程序集不直接引用需要的业务模块程序集,而是将各业务模块程序集放置在指定的插件文件夹中,插件路径配置如下:

"TypeFinderOption": {
		"MountePath": ""//windows默认目录: C:/opt/netpro ; linux环境:/opt/netpro
	},

注意

引用程序集会自动注入相关服务,无需再进行Service.Add..();

使用

appsetting.json
      //按需要配置以下节点,可忽略
      "NetProOption": {
		//"UseResponseCompression": false, //是否启用响应压缩
		//"ThreadMinCount": 5, //最小线程数
		//"ApplicationName": "", //应用名称
		//"RequestWarningThreshold": 5, //请求时长的警告临界值
		//"RoutePrefix": "api" //全局路由前缀
	},

内置中间件与系统中间件的映射关系:


public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
	
    app.UseExceptionHandler();   //对应ErrorHandlerStartup
    
	// your code
	...//此区间请求管道上的Order取值 范围0-100

    app.UseStaticFiles();        //对应StaticFilesStartup

	// your code
	...//此区间请求管道上的Order取值 范围101-200

    app.UseRouting();            //对应RoutingStartup

    // your code
	...//此区间请求管道上的Order取值 范围200-1000

    app.UseEndpoints(endpoints =>//对应EndpointsStartup
    {
        endpoints.MapRazorPages();
    });
}

考虑到灵活性,Netpro.Web.APi不包含UseEndpoints处理,如果不是通过脚手架生成NetPro项目,需要手动增加以下文件EndpointsStartup.cs到项目中

// <auto-generated>
//  UseEndpoints   
// </auto-generated>

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace NetPro.Web.Api
{
    /// <summary>
    /// Endpoints 
    /// </summary>
    public class EndpointsStartup : INetProStartup
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="services"></param>
        /// <param name="configuration"></param>
        /// <param name="typeFinder"></param>
        public void ConfigureServices(IServiceCollection services, IConfiguration configuration, TypeFinder.ITypeFinder typeFinder)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="application"></param>
        public void Configure(IApplicationBuilder application)
        {
            application.UseEndpoints(s =>
            {
                s.MapControllers();//add other operation
            });
        }

        /// <summary>
        /// UseEndpoints should be loaded last
        /// </summary>
        public double Order { get; set; } = 1000;
    }
}

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
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 (1)

Showing the top 1 popular GitHub repositories that depend on NetPro.Web.Api:

Repository Stars
LeonKou/NetPro
🌈An enhanced version with clean architecture of asp.netcore,efficiently manage startup,Support for netcore3.1/6.0
Version Downloads Last updated
6.0.16 314 7/24/2023
6.0.15 766 7/19/2022
6.0.14 468 7/10/2022
6.0.13 502 6/15/2022
6.0.12 415 6/15/2022
6.0.11 401 6/15/2022
6.0.10 434 6/11/2022
6.0.9 430 6/8/2022
6.0.8 475 5/26/2022
6.0.8-beta.3 150 5/24/2022
6.0.8-beta.2 126 5/24/2022
6.0.7 441 5/18/2022
6.0.6 449 4/28/2022
6.0.5 453 3/30/2022
6.0.5-beta.20 112 4/27/2022
6.0.5-beta.19 128 4/25/2022
6.0.5-beta.18 118 4/22/2022
6.0.5-beta.17 133 4/16/2022
6.0.5-beta.16 206 4/8/2022
6.0.5-beta.15 122 4/8/2022
6.0.5-beta.14 135 4/7/2022
6.0.5-beta.13 128 4/7/2022
6.0.5-beta.12 124 4/6/2022
6.0.5-beta.11 153 4/6/2022
6.0.5-beta.10 146 3/31/2022
6.0.5-beta.9 137 3/26/2022
6.0.5-beta.8 159 3/22/2022
6.0.5-beta.7 137 3/21/2022
6.0.5-beta.6 143 3/14/2022
6.0.5-beta.5 145 3/2/2022
6.0.5-beta.4 145 2/22/2022
6.0.5-beta.3 139 2/18/2022
6.0.5-beta.2 128 2/18/2022
6.0.5-beta.1 132 2/16/2022
6.0.4 484 2/10/2022
6.0.3 475 2/9/2022
6.0.3-beta.9 128 2/10/2022
6.0.3-beta.8 153 1/27/2022
6.0.3-beta.7 144 1/19/2022
6.0.3-beta.6 146 1/17/2022
6.0.3-beta.5 140 1/17/2022
6.0.3-beta.4 145 1/16/2022
6.0.3-beta.3 143 1/14/2022
6.0.3-beta.2 137 1/13/2022
6.0.3-beta.1 168 1/11/2022
6.0.2 339 1/6/2022
6.0.1 1,001 12/3/2021
3.1.11 464 11/19/2021 3.1.11 is deprecated because it has critical bugs.
3.1.10 1,176 7/29/2021
3.1.9 1,090 7/1/2021
3.1.8 1,092 12/15/2020
3.1.6 1,232 9/16/2020
3.1.5 1,120 9/8/2020
3.1.4 1,287 6/30/2020
3.1.3 1,180 6/23/2020
3.1.2 1,356 5/26/2020
3.1.1 1,196 5/26/2020
3.1.0 1,226 5/24/2020
1.0.1 1,337 5/4/2020
1.0.0 1,202 4/27/2020