2022年7月30日

摘要: 1.nuget添加引用 Autofac Autofac.Extensions.DependencyInjection 2.建立自定义的MyApplicationModule类,继承自Autofac.Module using Autofac; using System.Reflection; name 阅读全文

posted @ 2022-07-30 11:50 樱木007 阅读(173) 评论(0) 推荐(0) 编辑

摘要: 主要两个步骤: 1.注册服务 builder.Services.AddScoped<ITestServiceA, TestServieceA>(); 2.使用 app.MapGet("TestServiceAShowA",([FromServices] ITestServiceA testServi 阅读全文

posted @ 2022-07-30 10:57 樱木007 阅读(111) 评论(0) 推荐(0) 编辑

摘要: using Microsoft.AspNetCore.Mvc; using MininalApi.Demo1; WebApplicationBuilder builder = WebApplication.CreateBuilder(args); builder.Services.AddEndpoi 阅读全文

posted @ 2022-07-30 10:19 樱木007 阅读(134) 评论(0) 推荐(0) 编辑

摘要: 1.Restful风格 Program.cs的代码 builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); WebApplication app = builder.Build(); app.UseS 阅读全文

posted @ 2022-07-30 09:57 樱木007 阅读(250) 评论(0) 推荐(0) 编辑


Copyright © 2024 樱木007
Powered by .NET 8.0 on Kubernetes