05 2022 档案
摘要:1 private void GeneratePdf() 2 { 3 var pdfGeneratorFullPath = configuration.GetSection("Exe").GetSection("ExePath").Value;//获取exe目录 4 var pdfGenerator
阅读全文
摘要:1 var resultArray = await _lisfreeSql.Select<CodeSex, DzCodeSex>() 2 .LeftJoin((a, b) => a.Code == b.SexCode) 3 .Where((a, b) => b.HospitalId == null
阅读全文
摘要:1、Excel帮助类 1 public static class ExcelHelper 2 { 3 public static DataTable ReadToDataTable(string strFileName) 4 { 5 IWorkbook workbook; 6 using (File
阅读全文
摘要:1 public async Task Execute(IJobExecutionContext context) 2 { 3 var filePath = _configuration.GetSection("TempFolderPath").GetSection("Path").Value; 4
阅读全文
摘要:source=map.Map<T>(source) 这个写法会new()一个新对象,map.Map(source,destination)则不会。后者效率会更高。 他们的差别在于 new之后可能会把不需要映射的属性的值给初始化。 例如: 3 var a =new Demo {Id = 123 ,Na
阅读全文
摘要:1 1、读取文件,并转换为字节流 2 FileStream fs = new FileStream(filename,FileMode.Open,FileAccess.Read); 3 byte[] infbytes = new byte[(int)fs.Length]; 4 fs.Read(inf
阅读全文
摘要:1 public static void request() 2 { 3 string filepath = path; 4 var formDatas = new List<FormItemModel>(); 5 //添加文件 6 formDatas.Add(new FormItemModel()
阅读全文
摘要:public string Post(string postdata, string url) { string result = string.Empty; try { HttpWebRequest? request = WebRequest.Create(url) as HttpWebReque
阅读全文
摘要:1 public static List<T> TableToListModel<T>(DataTable dt) where T : new() 2 { 3 List<T> res = new List<T>(); 4 // 获得此模型的类型 5 Type type = typeof(T); 6
阅读全文
摘要:在.NET CORE中,我们可以使用AutoMapper来实现对象数据传输也就是Dto。 1、需要安装如下两个包,通过Nuget安装即可: 1 AutoMapper 2 AutoMapper.Extensions.Microsoft.DependencyInjection 2、在Startup中添加
阅读全文