.net Core
Huge·C
这个作者很懒,什么都没留下…
展开
-
SaveChanges/提交事务时错误,提示:无法执行该事务操作,因为有挂起请求正在此事务上运行。
无法执行该事务操作,因为有挂起请求正在此事务上运行解决方法原创 2022-10-24 16:15:46 · 689 阅读 · 0 评论 -
实体转Hashtable,按照字典序排序并做MD5
/// <summary> /// 将实体转换为Hashtable /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="obj">实体实例</param> /// <returns>Hashtable</returns>...原创 2022-01-29 13:32:24 · 467 阅读 · 0 评论 -
.net core Swagger不加载实体模型备注
原因,接口实体和网站项目不在同一项目中。解决办法:右键实体所在项目文件→属性→生成→输出→勾选XML文档文件。在Startup,AddSwaggerGen中配置 var files = Directory.GetFiles(Path.GetDirectoryName(typeof(Startup).Assembly.Location)); foreach (var file in files) {原创 2021-11-09 13:21:42 · 657 阅读 · 0 评论 -
Cannot access a disposed object. A common cause of this error is disposing a context that ...问题解决
异常:Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Di原创 2021-10-20 08:46:11 · 1484 阅读 · 0 评论 -
EntityFramework懒加载
表关系如下图查询表A所有数据DbContext.A.ToList();查询表A同时加载A-1,A-2DbContext.A.Include(p=>p.A-1).Include(p=>p.A-2);查询表A同时加载A-1,A-1-1,A-2,A-2-1DbContext.A.Include(p=>p.A-1) .ThenInclude(A1 => A1.A11).Include(p=>p.A-2); .ThenIncl...原创 2020-09-15 13:43:20 · 219 阅读 · 0 评论 -
.net Core下用HttpContext接收微信支付回调。
1.Startup.cs文件中分别增加配在ConfigureServices中添加 services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();2.在接收回调类中添加private readonly IHttpContextAccessor _accessor;3.接收并解析微信通知 var httpcontext = _accessor.HttpContext;...原创 2020-05-12 09:36:32 · 1082 阅读 · 0 评论