学海无涯

导航

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);

  

  

posted on 2023-08-25 15:50  宁静致远.  阅读(12)  评论(0编辑  收藏  举报