随笔分类 -  .netcore

摘要:var name="张"; var sql = "select * from goods where name like @name "; var res = conn.Query<Goods>(sql, new { @name = name + '%' }).ToList(); 阅读全文
posted @ 2022-12-29 20:31 lunawzh 阅读(365) 评论(0) 推荐(0)
摘要:一、HashSet去重 1、对简单类型的去重 HashSet<int> ints = new HashSet<int>() { 1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1}; foreach (var item in ints) { Console.WriteLine(ite 阅读全文
posted @ 2022-06-25 08:57 lunawzh 阅读(499) 评论(0) 推荐(0)
摘要:直接看实例 对日期字符串提取期中的数字 1、使用match string d = "12/5/2022 14:55:40"; var reg = new Regex(@"^(\d{1,2})\/(\d{1,2})\/(\d{4})\s+(.+)"); var ms = reg.Match(d); i 阅读全文
posted @ 2022-04-18 17:09 lunawzh 阅读(206) 评论(0) 推荐(0)
摘要:System.Text.Json.JsonException: A possible object cycle was detected. This can either be due to a cycle or if the object depth is larger than the maxi 阅读全文
posted @ 2022-02-19 17:50 lunawzh 阅读(838) 评论(0) 推荐(0)
摘要:错误信息: A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum 阅读全文
posted @ 2022-02-05 18:33 lunawzh 阅读(309) 评论(0) 推荐(0)
摘要:如果商品与货柜存在外键,比如: public class Good{ public long id{ get; set; } public string name{get;set;} public long CabinetId { get; set; } public Cabinet Cabinet 阅读全文
posted @ 2022-02-05 11:19 lunawzh 阅读(48) 评论(0) 推荐(0)
摘要:表示用于管理资源访问的锁定状态,可实现多线程读取或进行独占式写入访问 ReaderWriterLockSlim 类支持三种锁定模式:Read,Write,UpgradeableRead。这三种模式对应的方法分别是 EnterReadLock,EnterWriteLock,EnterUpgradeab 阅读全文
posted @ 2021-11-05 11:12 lunawzh 阅读(1152) 评论(0) 推荐(0)
摘要:执行非查询原生SQL string msg = "内容"; await db.Database.ExecuteSqlInterpolatedAsync($"delete from comments where title={msg}"); 实体相关的查询SQL , FromSqlInterpolat 阅读全文
posted @ 2021-11-04 23:09 lunawzh 阅读(971) 评论(0) 推荐(0)
摘要:转 https://www.tnblog.net/aojiancc/article/details/3284 阅读全文
posted @ 2021-08-22 23:48 lunawzh 阅读(204) 评论(0) 推荐(0)
摘要:出错 var applicationform = db.ApplicationForm.Where(x => applicationformids.Contains(x.id)); foreach (var item in applicationform) { var supply = realNe 阅读全文
posted @ 2021-08-22 19:27 lunawzh 阅读(903) 评论(0) 推荐(0)
摘要:页面中经常用到,记录一下 div <div id="cover"><img src="/images/loading.gif" style="width: 80px; height: 80px;"/></div> css #cover { position: absolute; left: 0px; 阅读全文
posted @ 2021-08-22 14:13 lunawzh 阅读(651) 评论(0) 推荐(0)
摘要:The LINQ expression 'DbSet<Supplies>() .Where(s => s.alarmState == "缺货") .Where(s => !(__invalidList_0 .Any(y => s.id == y.id)))' could not be transla 阅读全文
posted @ 2021-08-21 22:29 lunawzh 阅读(5056) 评论(1) 推荐(0)
摘要:简单的实现每天运行一次的定时器,执行时间放在数据库为了用户能方便随意修改。 一、使用System.Threading.Timer 实现方式,通过backgroundService后台任务,放入每1小时查看数据库中的时间一次,如果执行时间正好在1小时之内,就使用System.Threading.Tim 阅读全文
posted @ 2021-08-19 21:05 lunawzh 阅读(1526) 评论(0) 推荐(0)
摘要:有可能是: 可能是因为你的EntityModel中字段类型与数据表中字段的类型不一致引起的。 例如:Db(A某字段为Number类型) Entity(A某字段为string类型) 那么就会报错:System.InvalidCastException:“Specified cast is not va 阅读全文
posted @ 2021-08-19 14:54 lunawzh 阅读(993) 评论(0) 推荐(0)
摘要:转 https://www.cnblogs.com/luna-hehe/p/9146142.html 阅读全文
posted @ 2021-08-17 21:53 lunawzh 阅读(206) 评论(0) 推荐(0)
摘要:转: https://www.cnblogs.com/mq0036/p/9400268.html 阅读全文
posted @ 2021-08-17 20:38 lunawzh 阅读(882) 评论(0) 推荐(0)
摘要:使用DI读取配置,读取时声明类型有IOptions<T>、IOptionsMonitor<T>、IOtionsSnapshot<T>类型,推荐使用最后一种。 要读取的配置文件 jsconfig.json 如下,把属性改成始终复制。 { "Name": "wzh", "addr": "beijing" 阅读全文
posted @ 2021-08-10 13:36 lunawzh 阅读(139) 评论(0) 推荐(0)
摘要:错误: System.AggregateException:“Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Microsoft.Ext 阅读全文
posted @ 2021-08-06 21:25 lunawzh 阅读(5305) 评论(0) 推荐(0)
摘要:比如: 方法 public static IQueryable<Teacher> GetData() { using(var db=new MyDbCotext()) { return db.Teachers.Include(x => x.Students); } } 调用此方法 var list 阅读全文
posted @ 2021-07-15 16:56 lunawzh 阅读(81) 评论(0) 推荐(0)
摘要:把当前目录下的WzhTest.dll文件拷贝到窗口 docker cp ./WzhTest.dll wzh-netmvc:app/WzhTest.dll 启动容器 docker restart wzh-netmvc 进入窗口 docker exec -it wzh-netmvc /bin/bash 阅读全文
posted @ 2021-07-06 21:00 lunawzh 阅读(53) 评论(0) 推荐(0)