• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






java小兵

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 4 5 6 ··· 12 下一页

2022年2月13日

asp.net core transaction support filter
摘要: TransactionScopeFilter [AttributeUsage(AttributeTargets.Method)] public class TransactionalSupportAttribute : Attribute { } public class TransactionSc 阅读全文
posted @ 2022-02-13 19:01 .net一小兵 阅读(62) 评论(0) 推荐(0)
 

2022年2月12日

asp.net core exception filter
摘要: exception filter public class MyExceptionFilter : IAsyncExceptionFilter { private IWebHostEnvironment WebHostEnvironment { get; set; } public MyExcept 阅读全文
posted @ 2022-02-12 20:01 .net一小兵 阅读(68) 评论(0) 推荐(0)
 

2022年2月11日

asp.net core IDistributedCache
摘要: 使用redis包 install-package Microsoft.Extensions.Caching.Redis 配置redis-server builder.Services.AddDistributedRedisCache(options => { options.InstanceName 阅读全文
posted @ 2022-02-11 20:24 .net一小兵 阅读(248) 评论(0) 推荐(0)
 

2022年2月9日

asp.net core 缓存使用
摘要: // 在program.cs中加入这句,加入缓存支持 builder.Services.AddMemoryCache(); public class Book { public int Id { get; init; } public string Title { get; init; } publ 阅读全文
posted @ 2022-02-09 18:50 .net一小兵 阅读(112) 评论(0) 推荐(0)
 

2022年2月6日

asp.net core 参数使用
摘要: [ApiController] [Route("[controller]")] public class PersonController : ControllerBase { [HttpGet("add")] // 如果使用[controller]/[action],则url变成Person/Ad 阅读全文
posted @ 2022-02-06 12:43 .net一小兵 阅读(235) 评论(0) 推荐(0)
 

2022年2月5日

dotnet record
摘要: 本质上record是一个实现了Equals()/GetHashCode()和ToString()的class record Person(int Id, string Name, int Age) // 这3个都是只读属性 { public string NickName { get; set; } 阅读全文
posted @ 2022-02-05 09:07 .net一小兵 阅读(94) 评论(0) 推荐(0)
 

2022年2月4日

dotnetcore EF 动态查询指定列
摘要: 普通情况下,可以通过select实现查询指定列, ctx.Students.Select(s => new {s.Id, s.Name}); ctx.Students.Select(s => new object[] {s.Id, s.Name}); 这里使用动态方式实现select查询指定列 us 阅读全文
posted @ 2022-02-04 19:01 .net一小兵 阅读(617) 评论(0) 推荐(0)
 
dotnetcore EF 表达式
摘要: 使用Expression using (MyDbContext ctx = new MyDbContext()) { Expression<Func<Student, bool>> exp01 = s => s.Name.Contains("stu"); foreach (Student s in 阅读全文
posted @ 2022-02-04 18:09 .net一小兵 阅读(67) 评论(0) 推荐(0)
 

2022年2月3日

dotnetcore EF 乐观锁并发控制
摘要: 使用IsConcurrencyToken()设置并发token builder.Property(h => h.Owner).IsConcurrencyToken(); 使用SQL语句类似以下 update house set owner = @p0 where id = 1 and owner = 阅读全文
posted @ 2022-02-03 19:22 .net一小兵 阅读(278) 评论(0) 推荐(0)
 
dotnetcore EF 查询筛选
摘要: 增加IsDeleted属性 软删除,设置IsDelete为true Student s = ctx.Students.FirstOrDefault(s => s.Id == 10); s.IsDeleted = true; await ctx.SaveChangesAsync(); 调用HasQue 阅读全文
posted @ 2022-02-03 18:22 .net一小兵 阅读(89) 评论(0) 推荐(0)
 
上一页 1 2 3 4 5 6 ··· 12 下一页