上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 43 下一页
摘要: builder.Services.AddAuthentication(option => { option.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; }).AddCookie(Cook 阅读全文
posted @ 2024-08-08 08:44 龙卷风吹毁停车场 阅读(5) 评论(0) 推荐(0)
摘要: var groupData = context.Students // 使用GroupBy分组,依据ClassId .GroupBy(s => s.ClassId) .Select(g => new { // 拿到ClassId,由于是按ClassId分组的,因此使用Max还是Min得到的一样的 C 阅读全文
posted @ 2024-08-07 14:01 龙卷风吹毁停车场 阅读(112) 评论(0) 推荐(0)
摘要: using var transaction = context.Database.BeginTransaction(); try { // 批量添加1 context.AddRange(new List<Student>() { new Student(){ ClassId=3,Name="cc" 阅读全文
posted @ 2024-08-07 13:55 龙卷风吹毁停车场 阅读(21) 评论(0) 推荐(0)
摘要: 1.第一步,在启动文件添加 builder.Services.AddHttpClient(); 实体类: public class SearchReq { public string Name { get; set; } public string Description { get; set; } 阅读全文
posted @ 2024-08-06 16:16 龙卷风吹毁停车场 阅读(60) 评论(0) 推荐(0)
摘要: 1.第一步: 在启动文件中加入 builder.Services.AddHttpClient(); 2. 第二步: using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.Net.Http; name 阅读全文
posted @ 2024-08-06 15:55 龙卷风吹毁停车场 阅读(23) 评论(0) 推荐(0)
摘要: 1. 选择右侧项目文件,单机右键,选择"编辑项目文件",打开如下 <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> //<Nullable>enable</N 阅读全文
posted @ 2024-08-05 11:08 龙卷风吹毁停车场 阅读(20) 评论(0) 推荐(0)
摘要: 读取单个配置 举例: 获取mes的内容 第一种方式: 使用IConfiguration app.MapGet("/test", (IConfiguration configuration) => { return configuration["mes"]; }); 第二种,getvalue获取 ap 阅读全文
posted @ 2024-08-04 17:53 龙卷风吹毁停车场 阅读(108) 评论(0) 推荐(0)
摘要: 在启动项 Program.cs 文件中添加 //app.UseStaticFiles(); // 启动静态文件中间件,默认访问wwwroot app.UseStaticFiles(new StaticFileOptions() { //修改默认访问地址为MyStaticFiles文件 FilePro 阅读全文
posted @ 2024-08-04 17:16 龙卷风吹毁停车场 阅读(4) 评论(0) 推荐(0)
摘要: 1.第一步首先创建一个webapi项目2.安装nuget包: Microsoft.AspNetCore.Authentication.JwtBearer 3.,然后再Program.cs文件中添加 4.然后运行起来 5. 打开 jwt.io 网站,解密token 关于: iss, sub, exp, 阅读全文
posted @ 2024-07-15 15:05 龙卷风吹毁停车场 阅读(21) 评论(0) 推荐(0)
摘要: //nuget安装: Microsoft.Extensions.DependencyInjection //ServiceCollection的生命周期 //AddTransient 瞬时生命周期,每次创建都是一个全新的实例 //AddSingleton 单列生命周期,同一个类型创建出来的是同一个实 阅读全文
posted @ 2024-07-12 16:41 龙卷风吹毁停车场 阅读(8) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 43 下一页