<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : ArgumentOutOfRange AddEntity</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : ArgumentOutOfRange AddEntity</description>
  <pubDate>Mon, 13 Apr 2026 12:29:26 -700</pubDate>
  <lastBuildDate>Mon, 24 Oct 2011 11:26:32 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3048</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>ArgumentOutOfRange AddEntity : Hi smi-mark;We can investigate...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11927#11927</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3048<br /><strong>Posted:</strong> 24-Oct-2011 at 11:26am<br /><br />Hi smi-mark;<div><br></div><div>We can investigate this further if you can send us your edmx, a sql script to create the involved tables and any other info that you think might help us reproduce the issue here. You can use the customer's support form to attach your files.</div><div><br></div><div><a href="http://www.ideablade.com/technical-support/CustomerSupportRequest&#070;orm.aspx" target="_blank">http://www.ideablade.com/technical-support/CustomerSupportRequestForm.aspx</a></div>]]>
   </description>
   <pubDate>Mon, 24 Oct 2011 11:26:32 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11927#11927</guid>
  </item> 
  <item>
   <title>ArgumentOutOfRange AddEntity : I think I found the problem. I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11925#11925</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 3048<br /><strong>Posted:</strong> 22-Oct-2011 at 5:52pm<br /><br />I think I found the problem. I completely recreated the entities, but then I noticed there were some old entities that still inherited from Promotion. They didn't exist in the model but the partial files still existed. I'm not sure why it was erroring though. Very strange.<br>]]>
   </description>
   <pubDate>Sat, 22 Oct 2011 17:52:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11925#11925</guid>
  </item> 
  <item>
   <title>ArgumentOutOfRange AddEntity : Any clues? It&amp;#039;s got something...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11924#11924</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 3048<br /><strong>Posted:</strong> 21-Oct-2011 at 7:48pm<br /><br />Any clues? It's got something to do with the relationship to the Promotion table.&nbsp; As soon as I delete the association it works fine.<br><br>Promotion is an abstract table, there are two tables PercentageOffPromotion and SpecialPricePromotion that inherit from it. <br><br>This was working fine for ages. I have no idea what is causing the problem.<br>]]>
   </description>
   <pubDate>Fri, 21 Oct 2011 19:48:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11924#11924</guid>
  </item> 
  <item>
   <title>ArgumentOutOfRange AddEntity : Something is altering the Entity...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11918#11918</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 3048<br /><strong>Posted:</strong> 21-Oct-2011 at 8:47am<br /><br />Something is altering the Entity after AddEntity and before it hits ConvertValues, or it's not finding the key.<br><br>calling this works fine:<br><br><pre style="font-family:C&#111;nsolas;font-size:13;color:black;:white;">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;method&nbsp;=&nbsp;<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">EntityKey</span>).GetMethod(<span style="color:#a31515;">"ConvertValues"</span>,&nbsp;<span style="color:#2b91af;">BindingFlags</span>.NonPublic&nbsp;|&nbsp;<span style="color:#2b91af;">BindingFlags</span>.Instance);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;method.Invoke(key,&nbsp;<span style="color:blue;">null</span>);</pre><br>The problem seems to start from&nbsp; IdeaBlade.EntityModel.EntityManager.FindEntityWrapper(EntityKey entityKey, Boolean includeDeleted)<br><br>]]>
   </description>
   <pubDate>Fri, 21 Oct 2011 08:47:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11918#11918</guid>
  </item> 
  <item>
   <title>ArgumentOutOfRange AddEntity : Upgraded to 6.1.3.1 no difference.  ...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11917#11917</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 3048<br /><strong>Posted:</strong> 20-Oct-2011 at 10:18pm<br /><br />Upgraded to 6.1.3.1 no difference.]]>
   </description>
   <pubDate>Thu, 20 Oct 2011 22:18:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11917#11917</guid>
  </item> 
  <item>
   <title>ArgumentOutOfRange AddEntity :  I have no idea why this is happeningI...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11916#11916</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 3048<br /><strong>Posted:</strong> 20-Oct-2011 at 9:43pm<br /><br />I have no idea why this is happening<br><br>I have the following code, and it only seems to happen with this entity type:<br><br><pre style="font-family:C&#111;nsolas;font-size:13;color:black;:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">public</span>&nbsp;<span style="color:#2b91af;">PromotionLine</span>&nbsp;AddProduct(<span style="color:#2b91af;">Product</span>&nbsp;product)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;promotionLine&nbsp;=&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">PromotionLine</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PromotionId&nbsp;=&nbsp;PromotionId,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PromotionLinkType&nbsp;=&nbsp;(<span style="color:blue;">byte</span>)<span style="color:#2b91af;">PromotionLinkType</span>.Product,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LinkId&nbsp;=&nbsp;product.ProductId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EntityManager.AddEntity(promotionLine);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">return</span>&nbsp;promotionLine;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>Index was out of range. Must be non-negative and less than the size of the collection.<br>Parameter name: index<br><br>   at System.ThrowHelper.ThrowArgumentOutOfRangeException()<br>   at System.Collections.Generic.List`1.get_Item(Int32 index)<br>   at IdeaBlade.EntityModel.EntityKey.ConvertValues()<br>   at IdeaBlade.EntityModel.EntityGroup.FindEntityWrapper(EntityKey entityKey, Boolean includeDeleted)<br>   at IdeaBlade.EntityModel.EntityManager.FindEntityWrapper(EntityKey entityKey, Boolean includeDeleted)<br>   at IdeaBlade.EntityModel.ScalarEntityReference`1.FindToEntity()<br>   at IdeaBlade.EntityModel.ScalarEntityReference`1.FixupReferences()<br>   at IdeaBlade.EntityModel.EntityAspect.&lt;FixupReferences&gt;b__19(EntityReferenceBase eref)<br>   at IdeaBlade.Core.EnumerableFns.ForEach&#091;T&#093;(IEnumerable`1 items, Action`1 action)<br>   at IdeaBlade.EntityModel.EntityAspect.FixupReferences()<br>   at IdeaBlade.EntityModel.EntityAspect.TrackChanged(EntityChangedEventArgs e)<br>   at IdeaBlade.EntityModel.EntityGroup.OnEntityChanged(EntityChangedEventArgs e)<br>   at IdeaBlade.EntityModel.EntityGroup.AddAttachedEntity(EntityAspect wrapper, EntityState entityState)<br>   at IdeaBlade.EntityModel.EntityManager.AttachEntityAspect(EntityAspect aspect, EntityState entityState)<br>   at IdeaBlade.EntityModel.EntityManager.AttachEntity(Object entity, EntityState entityState)<br>   at IdeaBlade.EntityModel.EntityManager.AddEntity(Object entity)<br><br>Even just doing this errors:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">var</span>&nbsp;promotionLine&nbsp;=&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">PromotionLine</span>();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EntityManager.AddEntity(promotionLine);<br><br><br>This is the ctor:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">internal</span>&nbsp;PromotionLine()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PromotionLineId&nbsp;=&nbsp;<span style="color:#2b91af;">Guid</span>.NewGuid();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>Any clues?<br></pre><br><span style="font-size:10px"><br /><br />Edited by smi-mark - 21-Oct-2011 at 8:15pm</span>]]>
   </description>
   <pubDate>Thu, 20 Oct 2011 21:43:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3048&amp;PID=11916#11916</guid>
  </item> 
 </channel>
</rss>