C#编程经验
反射得到属于的值:
var type = myTechs.GetType();
tech myTech = type.GetProperty(techName).GetValue(myTechs) as tech;
属于名:techName
设置 decimal 类型属性的精度
public class LibBomFlowAsmConfig : IEntityTypeConfiguration<LibBomFlowAsm> { public void Configure(EntityTypeBuilder<LibBomFlowAsm> builder) { builder.Property(x => x.num).HasPrecision(18, 6); } }
查询列表转换成字典
var customerDic= _appDbContext.Customer.Select(m => new { m.Id, m.Code }).ToDictionary(m=>m.Id,m=>m.Code);