NetCore WebApi 应用事项,验证,授权,数据库Orm(EFCore、XPO等)

一、参考

0、DevExpress  XPO  在 Net Core 的应用:https://docs.devexpress.com/XPO/119377/getting-started/getting-started-with-.net-core?utm_source=DevExpress&utm_medium=Website&utm_campaign=XPO&utm_content=XPO_Try_NET_Core_Beta

1、首先参考:我的第一个netcore2.2 api项目搭建(一)   https://www.cnblogs.com/sy-ds/p/10832504.html

2、ASP.NET Core OceLot 微服务实践   http://www.mamicode.com/info-detail-2425907.html

3、ASP.NET Core WebApi使用Swagger生成api说明文档看这篇就够了

4、ASP.NET Core 新核心对象WebHost(一) http://www.jessetalk.cn/2017/11/11/aspnet-core-object-webhost/

      启用身份验证 Startup 中增加     app.UseAuthentication();

5、jwt-dotnet/jwt   https://github.com/jwt-dotnet/jwt

    Jwt.Net, 一个 JWT (JSON Web Token) 的NET实现,用于WebAPI  身份验证。

 6、IdentityModel extensions for .Net  微软   https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet

 7、IdentityServer4 百度脑图     IdentityServer4 知多少  https://www.jianshu.com/p/56b577d8f786

 

二、使用 Swagger 的过程:

1、nuget搜索:Swashbuckle.AspNetCore,安装 Swagger 工具 Nuget包。

     详细使用参考:https://github.com/domaindrivendev/Swashbuckle.AspNetCore

2、NSwag  另一个 :https://github.com/RicoSuter/NSwag

2、在startup 的 ConfigureServices  注册swagger

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1", new Info
                {
                    //Version = "v1",
                    Title = "MyFirst API",//" API",
                });

                // Set the comments path for the Swagger JSON and UI.
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); options.IncludeXmlComments(xmlPath, true); xmlPath = Path.Combine(AppContext.BaseDirectory, "JH.OPEMR.Model.xml"); options.IncludeXmlComments(xmlPath, true);
            });
3、在Configure中启用swagger
            app.UseSwagger();
            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});

 三、网关 Ocelot  

     .NET core API Gateway http://threemammals.com/ocelot

      eShopOnContainers  :  https://github.com/dotnet-architecture/eShopOnContainers

 使用说明:  https://ocelot.readthedocs.io/en/latest/index.html
超级框架: https://github.com/geffzhang/NanoFabric
posted @ 2019-08-24 19:18  Hopesun  阅读(526)  评论(0编辑  收藏  举报