<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/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>Data Access and ObjectDataSource Control</title><link>http://forums.asp.net/23.aspx</link><description>Questions and discussions related to using ADO.NET for data access, and the ObjectDataSource control. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=9&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: How we get data Many to many Relationship in EDM</title><link>http://forums.asp.net/thread/3207791.aspx</link><pubDate>Wed, 03 Jun 2009 14:41:02 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3207791</guid><dc:creator>Qasimali84</dc:creator><author>Qasimali84</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3207791.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3207791</wfw:commentRss><description>&lt;p&gt;Great hint It solved my problem&lt;/p&gt;</description></item><item><title>Re: How we get data Many to many Relationship in EDM</title><link>http://forums.asp.net/thread/3174574.aspx</link><pubDate>Wed, 20 May 2009 07:12:46 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3174574</guid><dc:creator>cgeers</dc:creator><author>cgeers</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3174574.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3174574</wfw:commentRss><description>&lt;p&gt;Qasimali84,&lt;/p&gt;&lt;p&gt;Based on your question I assume the following:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;You have 5 tables in your database, namely [User], [Group], [Role], [GroupRoles], [GroupUsers]&lt;/li&gt;&lt;li&gt;The table [GroupRoles] links roles to groups and only contains two fields which are the primary keys of the tables [Group] and [Role]&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The table [GroupUsers] links users to groups and only contains two fields which are the primary keys of the tables [Group] and [User]&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The tables [GroupRoles] and [GroupUsers] don&amp;#39;t show up as separate entities in the model but are directly represented as navigation properties&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Then the code to perform your two queries (Linq to Entities) is the following: &lt;br /&gt;&lt;pre class="coloredcode"&gt;&lt;b id="1"&gt;1    &lt;/b&gt;&lt;span class="kwd"&gt;using&lt;/span&gt; (Entities context = &lt;span class="kwd"&gt;new&lt;/span&gt; Entities())&lt;br /&gt;&lt;b id="2"&gt;2    &lt;/b&gt;{&lt;br /&gt;&lt;b id="3"&gt;3    &lt;/b&gt;    &lt;span class="cmt"&gt;// Display the roles of a certain group&lt;/span&gt;&lt;br /&gt;&lt;b id="4"&gt;4    &lt;/b&gt;    var q = (from g &lt;span class="kwd"&gt;in&lt;/span&gt; context.Groups&lt;br /&gt;&lt;b id="5"&gt;5    &lt;/b&gt;             where g.Id == 1&lt;br /&gt;&lt;b id="6"&gt;6    &lt;/b&gt;             select g.Roles).FirstOrDefault();&lt;br /&gt;&lt;b id="7"&gt;7    &lt;/b&gt;    &lt;span class="kwd"&gt;foreach&lt;/span&gt;(var role &lt;span class="kwd"&gt;in&lt;/span&gt; q)&lt;br /&gt;&lt;b id="8"&gt;8    &lt;/b&gt;    {&lt;br /&gt;&lt;b id="9"&gt;9    &lt;/b&gt;        Console.WriteLine(role.RoleName);&lt;br /&gt;&lt;b id="10"&gt;10   &lt;/b&gt;    }&lt;br /&gt;&lt;b id="11"&gt;11   &lt;/b&gt;&lt;br /&gt;&lt;b id="12"&gt;12   &lt;/b&gt;    Console.WriteLine();&lt;br /&gt;&lt;b id="13"&gt;13   &lt;/b&gt;    // Display the roles of a certain user&lt;br /&gt;&lt;b id="14"&gt;14   &lt;/b&gt;    var q2 = (from g &lt;span class="kwd"&gt;in&lt;/span&gt; context.Groups&lt;br /&gt;&lt;b id="15"&gt;15   &lt;/b&gt;              where g.Users.Any(u =&amp;gt; u.Id == 1)&lt;br /&gt;&lt;b id="16"&gt;16   &lt;/b&gt;              select g.Roles).FirstOrDefault();&lt;br /&gt;&lt;b id="17"&gt;17   &lt;/b&gt;    &lt;span class="kwd"&gt;foreach&lt;/span&gt;(var role &lt;span class="kwd"&gt;in&lt;/span&gt; q2)&lt;br /&gt;&lt;b id="18"&gt;18   &lt;/b&gt;    {&lt;br /&gt;&lt;b id="19"&gt;19   &lt;/b&gt;        Console.WriteLine(role.RoleName);&lt;br /&gt;&lt;b id="20"&gt;20   &lt;/b&gt;    }&lt;br /&gt;&lt;b id="21"&gt;21   &lt;/b&gt;}&lt;br /&gt;&lt;/pre&gt;If you want the source code, just send me a private message with your e-mail address.&lt;br /&gt;&lt;p&gt;Regards,&lt;/p&gt;&lt;p&gt;Christophe &lt;br /&gt;&lt;/p&gt;</description></item><item><title>How we get data Many to many Relationship in EDM</title><link>http://forums.asp.net/thread/3151993.aspx</link><pubDate>Sat, 09 May 2009 06:36:27 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3151993</guid><dc:creator>Qasimali84</dc:creator><author>Qasimali84</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3151993.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=23&amp;PostID=3151993</wfw:commentRss><description>&lt;div&gt;I have three entities having many to many relationship in my EntityDesigner Diagram. &lt;br /&gt;&lt;/div&gt;
&lt;div&gt;1. User&lt;/div&gt;
&lt;div&gt;2.Group&lt;/div&gt;
&lt;div&gt;3. Role&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;1. User Entity has following structure&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &lt;/div&gt;
&lt;div&gt;&amp;nbsp;Scalar Properties 
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UserName&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Password&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; Active&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; Email&lt;/div&gt;
&lt;div&gt;Navigation Properties&lt;/div&gt;
&lt;div&gt;&amp;nbsp; Groups&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;2.Group Entities has following structure&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; 
&lt;div&gt;Scalar Properties&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/div&gt;
&lt;div&gt;&amp;nbsp;Navigation Properties&lt;/div&gt;
&lt;div&gt;&amp;nbsp; Users&lt;/div&gt;
&lt;div&gt;&amp;nbsp; Roles&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;3.Role Entities has following structure&amp;nbsp; 
&lt;div&gt;&amp;nbsp;&amp;nbsp; 
&lt;div&gt;Scalar Properties&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name&lt;/div&gt;
&lt;div&gt;&amp;nbsp;Navigation Properties&lt;/div&gt;
&lt;div&gt;&amp;nbsp;Groups&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;Now I have to &lt;br /&gt;1. Show All the roles against a group id in a gride view&lt;br /&gt;2. All the roles assigned against a userid in an other gride view&lt;br /&gt;&lt;br /&gt;How this task will be accomplished using EDM.&lt;br /&gt;What queries I have to write and what namespaces I have to use&lt;br /&gt;&lt;br /&gt;Thansk in Advance.&lt;/div&gt;
&lt;div&gt;&lt;img title="Entity Design Model" alt="Entity Design Model" src="http://forums.asp.net/C:/Documents%20and%20Settings/Administrator/Desktop/EDMUSer.JPEG" align="absMiddle" /&gt;&lt;/div&gt;</description></item></channel></rss>