<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.dotnetzone.gr:443/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>.NET Framework</title><link>https://www.dotnetzone.gr:443/cs/forums/14/ShowForum.aspx</link><description>Θέματα για threading, remoting, reflection, exception handling, security, regex κλπ.</description><dc:language>el</dc:language><generator>CommunityServer 2.1 SP3 (Build: 20423.1)</generator><item><title>Απ: Multiple Linq joins, ποιος είναι ο εσωτερικός τους μηχανισμός??</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/63190.aspx</link><pubDate>Fri, 11 Feb 2011 04:06:32 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:63190</guid><dc:creator>nikolaosk</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/63190.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=14&amp;PostID=63190</wfw:commentRss><description>&lt;P&gt;Σαν μια πρώτη πρόταση, θα μπορούσες να ανοίξεις τον SQL Server Profiler και να δεις τι SQL κώδικα παράγει το LINQ to SQL engine στις 2 περιπτώσεις.Επέλεξε σίγουρα τα 3 αυτά events&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;RPC:Starting,SQL:BatchStarting,SQL:BatchCompleted&lt;/STRONG&gt; του profiler.&lt;/P&gt;</description></item><item><title>Multiple Linq joins, ποιος είναι ο εσωτερικός τους μηχανισμός??</title><link>https://www.dotnetzone.gr:443/cs/forums/thread/63180.aspx</link><pubDate>Fri, 11 Feb 2011 01:16:07 GMT</pubDate><guid isPermaLink="false">2622095e-976c-431a-859e-16783ec7ecd7:63180</guid><dc:creator>pontifikas</dc:creator><slash:comments>0</slash:comments><comments>https://www.dotnetzone.gr:443/cs/forums/thread/63180.aspx</comments><wfw:commentRss>https://www.dotnetzone.gr:443/cs/forums/commentrss.aspx?SectionID=14&amp;PostID=63180</wfw:commentRss><description>Προσπαθώ να μεταφέρω ένα σενάριο SQL πολλαπλών temporary tables πάνω στα οποία κάνω μια σειρά από inner joints, σε LINQtoSQL&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Αντί για πολλαπλά tables λοιπόν έχω πολλαπλά collections με το SQL από&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;select&lt;/span&gt; Μπλα μπλα
&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;from&lt;/span&gt; (((((Table1 
&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;inner&lt;/span&gt; &lt;span style="color:Silver;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;join&lt;/span&gt; #col1 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;on&lt;/span&gt; #col1.to_1_ID = Table1_ID)
&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;inner&lt;/span&gt; &lt;span style="color:Silver;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;join&lt;/span&gt; #col2 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;on&lt;/span&gt; #col2.to_1_ID = Table1_ID)
&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;inner&lt;/span&gt; &lt;span style="color:Silver;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;join&lt;/span&gt; #col3 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;on&lt;/span&gt; #col3.to_1_ID = Table1_ID)
&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;inner&lt;/span&gt; &lt;span style="color:Silver;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;join&lt;/span&gt; #col4 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;on&lt;/span&gt; #col4.to_1_ID = Table1_ID)
&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;inner&lt;/span&gt; &lt;span style="color:Silver;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;join&lt;/span&gt; #col5 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;on&lt;/span&gt; #col5.to_1_ID = Table1_ID)
&lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;inner&lt;/span&gt; &lt;span style="color:Silver;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;join&lt;/span&gt; #col6 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;on&lt;/span&gt; #col6.to_1_ID = Table1_ID&lt;/span&gt;&lt;/pre&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#f2f2f2;border:solid 1px #e5e5e5;"&gt;&lt;tr style="vertical-align:top;line-height:normal;"&gt;&lt;td&gt;&lt;pre style="margin:0px;padding:2px;padding-left:8px;"&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;γίνεται σε κώδικα:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt; var simple &lt;span style="color:Red;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; from t1 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; dbContext.Table1
                         join col1 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection1 on Table1.Table1_ID equals col1.to_1_ID
                         join col2 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection2 on Table1.Table1_ID equals col2.to_1_ID
                         join col3 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection3 on Table1.Table1_ID equals col3.to_1_ID
                         join col4 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection4 on Table1.Table1_ID equals col4.to_1_ID
                         join col5 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection5 on Table1.Table1_ID equals col5.to_1_ID
                         join col6 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection6 on Table1.Table1_ID equals col6.to_1_ID
                         select &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;new&lt;/span&gt; {Μπλα μπλα}&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/pre&gt;Εκτελώντας το SQL στον SQL server, το αποτέλεσμα εμφανίζεται άμεσα. Εκτελώντας το LINQ κομμάτι μετά από ένα λεπτό τρώω στην μάπα Connection Timeout.&lt;/div&gt;&lt;div&gt;Αν όμως αλλάξω το LINQ ώστε κάθε collection να αναφέρεται στο κλειδί μέσω των entity references, και όχι με το δικό του foreign key:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;span style="color:Black;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt; var simple &lt;span style="color:Red;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;=&lt;/span&gt; from t1 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; dbContext.Table1
                         join col1 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection1 on Table1.Table1_ID equals col1.to_1_ID
                         join col2 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection2 on col1.Table1.Table1_ID equals col2.to_1_ID
                         join col3 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection3 on col2.Table1.Table1_ID equals col3.to_1_ID
                         join col4 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection4 on col3.Table1.Table1_ID equals col4.to_1_ID
                         join col5 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection5 on col4.Table1.Table1_ID equals col5.to_1_ID
                         join col6 &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;in&lt;/span&gt; Collection6 on col5.Table1.Table1_ID equals col6.to_1_ID
                         select &lt;span style="color:Blue;background-color:Transparent;font-family:Courier New;font-size:11px;font-weight:normal;"&gt;new&lt;/span&gt; {Μπλα μπλα}&lt;/span&gt;&lt;/pre&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;τότε δουλεύει κανονικά.&lt;/div&gt;&lt;div&gt;Γιατί συμβαίνει αυτό??&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;</description></item></channel></rss>