<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx</link><description>Note: This article has been updated for Beta 2 on 3/17/2011 Many business applications require many-to-many relationships. For example, an author can write many books , and a book can be written by many authors . To model this relationship in LightSwitch</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10385705</link><pubDate>Wed, 16 Jan 2013 22:56:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10385705</guid><dc:creator>HELP</dc:creator><description>&lt;p&gt;Can this be done on a List and Details screen. I am have issue getting it to work. &amp;nbsp;works fine on a New Data Screen&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10385705" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10369141</link><pubDate>Fri, 16 Nov 2012 07:02:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10369141</guid><dc:creator>lisnb</dc:creator><description>&lt;p&gt;it&amp;#39;s really helpful for me, thanks ~&lt;/p&gt;
&lt;p&gt;and lightswitch is so powerful that i can&amp;#39;t help getting to learn it.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10369141" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10287401</link><pubDate>Mon, 26 Mar 2012 01:56:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10287401</guid><dc:creator>ITPSB</dc:creator><description>&lt;p&gt;Actually best after:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MovieGenre mg = this.MovieGenres.AddNew();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mg.Movie = this.MovieProperty;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mg.Genre = this.Genres.SelectedItem&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mgExists.Delete(); // Add this line to delete instance after test&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10287401" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10287389</link><pubDate>Mon, 26 Mar 2012 00:34:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10287389</guid><dc:creator>ITPSB</dc:creator><description>&lt;p&gt;Just add this line to delete the test for the mgExits instanceafter the test is completed (see comment to the right of the added line below).&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partial void AddGenre_Execute()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;// Write your code here.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (Genres.SelectedItem != null)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MovieGenre mgExists = new MovieGenre();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (MovieGenre mgSearch in this.MovieGenres)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (mgSearch.Genre.Name == this.Genres.SelectedItem.Name)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mgExists = mgSearch;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (mgExists == null || mgExists.Genre == null)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mgExists.Delete(); // Add this line to delete instance after test&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;MovieGenre mg = this.MovieGenres.AddNew();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mg.Movie = this.MovieProperty;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mg.Genre = this.Genres.SelectedItem;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10287389" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10282386</link><pubDate>Tue, 13 Mar 2012 23:36:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10282386</guid><dc:creator>ITPSB</dc:creator><description>&lt;p&gt;Added Tom C code and it works like a charm! Many thanks Tom C.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10282386" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10282349</link><pubDate>Tue, 13 Mar 2012 23:00:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10282349</guid><dc:creator>ITPSB</dc:creator><description>&lt;p&gt;Hi Andy&lt;/p&gt;
&lt;p&gt;Many thanks for the very useful tutorial.&lt;/p&gt;
&lt;p&gt;A question: How can I enable multi-select of items to be added or removed (using shift/Ctrl-Select)?&lt;/p&gt;
&lt;p&gt;Best regards, Mark.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10282349" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10279836</link><pubDate>Thu, 08 Mar 2012 15:13:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10279836</guid><dc:creator>tpittson</dc:creator><description>&lt;p&gt;I am using this with 3 tables Tires, Compatible Tractors, and Tractors. &amp;nbsp;I want Tractors in list of Tractors to be copied to the Compatible Tractors table. &amp;nbsp;I think I have the relationships set up correctly. I have the UI set up so I looks like Andy&amp;#39;s but when I push the add Tractor button the compatible Tractors list just as a 0 and not the name of the tractor.&lt;/p&gt;
&lt;p&gt;Can someone let me know what I could be missing.&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10279836" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10261173</link><pubDate>Fri, 27 Jan 2012 12:34:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10261173</guid><dc:creator>gmach</dc:creator><description>&lt;p&gt;Andy, much thanks. Been puzzled since many-to-many was rejected in relationship dialog (LightSwitch 1.0)and have been scouring books and forums for an answer.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10261173" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10254068</link><pubDate>Fri, 06 Jan 2012 18:22:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10254068</guid><dc:creator>andy.kung</dc:creator><description>&lt;p&gt;@JDM. You can set it on the data property. To specify the number of items in a page, select a collection proptery (ex. MovieGenres in this tutorial) and you will find a &amp;quot;No. of items to display per page&amp;quot; in Properties. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10254068" width="1" height="1"&gt;</description></item><item><title>re: How to Create a Many-to-Many Relationship (Andy Kung)</title><link>http://blogs.msdn.com/b/lightswitch/archive/2010/12/16/how-to-create-a-many-to-many-relationship-andy-kung.aspx#10254066</link><pubDate>Fri, 06 Jan 2012 18:15:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10254066</guid><dc:creator>andy.kung</dc:creator><description>&lt;p&gt;@cte. The list in the example is directly bound to the Genre table. Removing an item in the list will remove the data from the Genre table, which is not what you want. So the answer is, unfortunately, no.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10254066" width="1" height="1"&gt;</description></item></channel></rss>