首页 > 代码库 > LinqPad4 Language

LinqPad4 Language

LinqPad有languange

C# Expression

在这个里面只能写一句linq语句,不能带结尾的分号

linq:

 from a in Alliance_SpecialCommission_Rules join b in Alliance_SpecialCommission_TicketsResources  on a.SCRuleID equals b.SCRuleID     select new{    a.AllianceID,b.ScenicName    } 

sql:

SELECT [t0].[AllianceID], [t1].[ScenicName]FROM [Alliance_SpecialCommission_Rules] AS [t0]INNER JOIN [Alliance_SpecialCommission_TicketsResource] AS [t1] ON [t0].[SCRuleID] = [t1].[SCRuleID]

 

left join

from a in Alliance_SpecialCommission_Rules join b in Alliance_SpecialCommission_TicketsResources on a.SCRuleID equals b.SCRuleID into joinData    from c in joinData.DefaultIfEmpty ()    select new{      a.SCRuleID ,a.AllianceID,a.BusinessType,c.ScenicName, c.ResourceName     } 
SELECT [t0].[SCRuleID], [t0].[AllianceID], [t0].[BusinessType], [t1].[ScenicName] AS [ScenicName], [t1].[ResourceName] AS [ResourceName]FROM [Alliance_SpecialCommission_Rules] AS [t0]LEFT OUTER JOIN [Alliance_SpecialCommission_TicketsResource] AS [t1] ON [t0].[SCRuleID] = [t1].[SCRuleID]

 

C# Statement(s)

里面可以有多句linq,也可以对对象进行进行赋值

var words=from word in "The quick brown fox jumps over the lazy dog".Split()orderby word.Lengthselect word;
words.Dump();
var sce= from a in Alliance_SpecialCommission_Rules join b in Alliance_SpecialCommission_TicketsResources on a.SCRuleID equals b.SCRuleID select new{ a.AllianceID,b.ScenicName }; sce.Dump();

C# Program

这个就像在vs里面了,可以有类

void Main(){        var classify_list = new List<Alliance_FAQ_Classify>            {                new Alliance_FAQ_Classify{ClassifyID =1,ClassifyName ="酒店"},                new Alliance_FAQ_Classify{ClassifyID =2,ClassifyName ="机票"},                new Alliance_FAQ_Classify{ClassifyID =3,ClassifyName ="团购"},                new Alliance_FAQ_Classify{ClassifyID =5,ClassifyName ="旅游"},                new Alliance_FAQ_Classify{ClassifyID =88,ClassifyName ="Other"}            };                  classify_list.Dump();            var info_list = new List<Alliance_FAQ_Info>            {                new Alliance_FAQ_Info{FAQID =1,ClassifyID =1},                new Alliance_FAQ_Info{FAQID =2,ClassifyID =1},                new Alliance_FAQ_Info{FAQID =3,ClassifyID =1},                new Alliance_FAQ_Info{FAQID =4,ClassifyID =1},                new Alliance_FAQ_Info{FAQID =5,ClassifyID =1},                new Alliance_FAQ_Info{FAQID =6,ClassifyID =1},                new Alliance_FAQ_Info{FAQID =7,ClassifyID =2},                new Alliance_FAQ_Info{FAQID =8,ClassifyID =2},                new Alliance_FAQ_Info{FAQID =9,ClassifyID =2},                new Alliance_FAQ_Info{FAQID =10,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =11,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =12,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =13,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =14,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =15,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =16,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =17,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =18,ClassifyID =3},                new Alliance_FAQ_Info{FAQID =19,ClassifyID =5},                new Alliance_FAQ_Info{FAQID =22,ClassifyID =5},                new Alliance_FAQ_Info{FAQID =19,ClassifyID =6},                new Alliance_FAQ_Info{FAQID =22,ClassifyID =6},                new Alliance_FAQ_Info{FAQID =19,ClassifyID =7},                new Alliance_FAQ_Info{FAQID =22,ClassifyID =7}            };            info_list.Dump();                         //left join            var list = from a in info_list                       join b in classify_list on a.ClassifyID equals b.ClassifyID into joinData                       from c in joinData.DefaultIfEmpty()                       select new                       {                           a.FAQID,                           a.ClassifyID ,                           Name=c!=null?c.ClassifyName :""                       };list.Dump();            var list2 = from a in classify_list                        join b in info_list on a.ClassifyID equals b.ClassifyID into joinData                        from c in joinData.DefaultIfEmpty()                        select new                        {                            a.ClassifyID ,                            a.ClassifyName ,                            FAQID=c==null?0:c.FAQID                         };                    list2.Dump();                                var words=from word in "The quick brown fox jumps over the lazy dog".Split()    orderby word.Length    select word;    words.Dump();        var sce= from a in Alliance_SpecialCommission_Rules join b in Alliance_SpecialCommission_TicketsResources  on a.SCRuleID equals b.SCRuleID         select new{        a.AllianceID,b.ScenicName        };         sce.Dump();             }    public class Alliance_FAQ_Info    {        public int FAQID { get; set; }        public int ClassifyID { get; set; }    }    public class Alliance_FAQ_Classify    {        public int ClassifyID { get; set; }        public string ClassifyName { get; set; }    }

LINQPAD4破解版(带智能感应)

http://www.cnblogs.com/qiuwuyu/archive/2011/08/30/2159089.html

http://www.cnblogs.com/li-peng/p/3441729.html

 

LinqPad4 Language