C#开发利器 Linq Pad 相关

时间:2022-05-26 02:07:04

Linq Pad 是平时在开发的过程中使用的利器,为什么这样说了。 你不用打开VS, 直接敲代码就行,F5运行即可以看到结果。 而且支持Linq, 是不错的选择。 

最近想开发一个日志分析工具,简单的日志分析工具。 使用linq 读取日志只有,直接写入到mysql 数据库,然后查询结果即可。这个项目我也是准备开源到GitHub

二,基础配置

先来一张截图:

基础的界面。 

三,数据库配置

如果需要链接mysql和其他数据库,,需要手动下载驱动。 或者直接从网站下载驱动。

导入驱动 :

四,执行sql 查询或者 linq 查询。

1 void Main() 2 { 3 4 5 /* 6 SELECT csdp.* from csdevdpoint csdp 7 INNER JOIN cscloudsdevice csd on csdp.CloudSDevice_PkId = csd.PkId 8 INNER JOIN cscloudsdgroupvalue csgv on csgv.CloudSDevice_PkId = csd.PkId 9 INNER JOIN cscloudsdgroup csg on csgv.CloudSDGroup_PkId = csg.PkId and csg.Flag = 0 10 where csg.CloudTreeKey = ? and csd.Flag = 0 and csdp.Flag = 0 */ 11 //查询 12 var all19 = (from csdp in Csdevdpoints 13 join csd in Cscloudsdevices 14 on csdp.CloudSDevice_PkId equals csd.PkId 15 join csgv in Cscloudsdgroupvalues 16 on csd.PkId equals csgv.CloudSDevice_PkId 17 join csg in Cscloudsdgroups 18 on csgv.CloudSDGroup_PkId equals csg.PkId 19 where 20 csdp.Flag == 0 21 && 22 csd.Flag == 0 23 && 24 csg.Flag == 0 25 && 26 csg.CloudTreeKey == "19:" 27 && 28 csdp.PointType == 123 29 select csdp ); 30 31 32 //all19.Dump(); 33 try { 34 foreach(var item in all19 ) { 35 var point = this.Pointinfos.FirstOrDefault( t => t.Pkid == item.PointId); 36 if(point != null) { 37 //point.Dump(); 38 if(! (point.EndpointType_ID == 123)) { 39 point.EndpointType_ID = 123; 40 this.SubmitChanges(); 41 }else { 42 point.Dump(); 43 } 44 } 45 } 46 }catch(Exception exp ) { 47 exp.Dump(); 48 } 49 } 50 51 // Define other methods and classes here

怎么样,是不是很好用。

附下载地址: