{"id":40,"date":"2006-05-15T09:48:10","date_gmt":"2006-05-15T07:48:10","guid":{"rendered":"http:\/\/soci.hu\/blog\/index.php\/2006\/05\/15\/using-linq-with-aspnet-part-1\/"},"modified":"2006-05-15T09:48:10","modified_gmt":"2006-05-15T07:48:10","slug":"using-linq-with-aspnet-part-1","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2006\/05\/15\/using-linq-with-aspnet-part-1\/","title":{"rendered":"Using LINQ with ASP.NET (Part 1)"},"content":{"rendered":"<p>Ez a LINQ dolog egyszer\u0171en zseni\u00e1lis, minden elismer\u00e9sem <a href=\"http:\/\/en.wikipedia.org\/wiki\/Anders_Hejlsberg\" target=\"_blank\">Hejlsberg<\/a> csapat\u00e1nak. Aki nem ismern\u00e9 a LINQ, Language Integrated Query egy olyan C# \u00e9s VB.NET \u00faj\u00edt\u00e1s a nyelvek k\u00f6vetkez\u0151 verzi\u00f3iban, amellyel\u00a0strongly typed\u00a0lek\u00e9rdez\u00e9seket lehet \u00edrni b\u00e1rmilyen adatforr\u00e1shoz, a nyelvbe integr\u00e1ltan. Teh\u00e1t nem Connection, Command meg\u00a0a t\u00f6bbi nyavajat\u00f6r\u00e9s, hanem direkben a nyelvekben lesz select, orderby, stb. M\u00f6g\u00f6tte persze ADO.NET vagy XML api lesz, nincsenek csod\u00e1k, de az el\u0151t\u00e9r nagyon kellemes lesz.<\/p>\n<p>Csak a f\u00edling mitt egy apr\u00f3 p\u00e9lda:<\/p>\n<p><font size=\"2\"><font face=\"Lucida Console\">\u00a0\u00a0\u00a0\u00a0\u00a0string[] cities = { &#8220;London&#8221;, &#8220;Amsterdam&#8221;, &#8220;San Francisco&#8221;, &#8220;Las Vegas&#8221;,<br \/>\n<\/font><\/font>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;Boston&#8221;, &#8220;Raleigh&#8221;, &#8220;Chicago&#8221;, &#8220;Charlestown&#8221;,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;Helsinki&#8221;, &#8220;Nice&#8221;, &#8220;Dublin&#8221; };<br \/>\n<span \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 GridView1.DataSource = <strong>from city in cities<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 where city.Length > 4<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 orderby city ascending<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 select city.ToUpper();<br \/>\n<\/strong><\/p>\n<p>Az eg\u00e9szben az tetszik, hogy nagyon b\u0151v\u00edthet\u0151 a modell, a l\u00e1tszat ellen\u00e9re nem kliensoldalon, mem\u00f3ri\u00e1ban teszi a dolg\u00e1t, hanem minden porcik\u00e1ja testreszabhat\u00f3, \u00edgy a processz\u00e1l\u00e1s tetsz\u0151leges r\u00e9sze \u00e1tpakolhat\u00f3 a szerverre, ha m\u00e1r egyszer ott egy okos adatb\u00e1zis van. Ami plusz pont, hogy az \u00faj funkci\u00f3k kedv\u00e9\u00e9rt tiszt\u00e1n a nyelveket szabt\u00e1k \u00e1t, a CLR-t nem kellett miatta \u00e1t\u00edrni.<\/p>\n<p>Scott Guthrie, ASP.NET vez\u00e9r \u00edrt egy <a href=\"http:\/\/weblogs.asp.net\/scottgu\/archive\/2006\/05\/14\/446412.aspx\" target=\"_blank\">sz\u00f6sszenetet<\/a>, ahol kev\u00e9s dum\u00e1val, sok k\u00e9ppel \u00e9s k\u00f3ddal megmutatja hogyan kell ASP.NET-ben haszn\u00e1lni a LINQ-et. Leny\u0171g\u00f6z\u0151 a LINQ, n\u00e9zz\u00e9tek meg.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ez a LINQ dolog egyszer\u0171en zseni\u00e1lis, minden elismer\u00e9sem Hejlsberg csapat\u00e1nak. Aki nem ismern\u00e9 a LINQ, Language Integrated Query egy olyan C# \u00e9s&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4],"tags":[],"class_list":["post-40","post","type-post","status-publish","format-standard","hentry","category-net","category-szakmai-elet"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=40"}],"version-history":[{"count":0,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/40\/revisions"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}