<?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 : SaveOptions</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2012 : SaveOptions</description>
  <pubDate>Fri, 10 Apr 2026 18:55:22 -700</pubDate>
  <lastBuildDate>Mon, 19 Nov 2012 07:20:06 -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=3805</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>SaveOptions : I found the reason why EF does...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15246#15246</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=243" rel="nofollow">cuneytgargin</a><br /><strong>Subject:</strong> 3805<br /><strong>Posted:</strong> 19-Nov-2012 at 7:20am<br /><br />I found the reason why EF does not create necessary FK relations..<div>I had a unique &nbsp;index on primary key.</div><div>And because of that, FK relations were not mapped. It is not a case of DevFoce, but Entity Framework.</div><div>B.R.</div>]]>
   </description>
   <pubDate>Mon, 19 Nov 2012 07:20:06 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15246#15246</guid>
  </item> 
  <item>
   <title>SaveOptions : I noticed something...Even I have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15238#15238</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=243" rel="nofollow">cuneytgargin</a><br /><strong>Subject:</strong> 3805<br /><strong>Posted:</strong> 19-Nov-2012 at 12:30am<br /><br />I noticed something...<div>Even I have a FK relation between Inventory And InventoryInvoicePictures Tables,</div><div>I cannot see a relation in EDMX diagram... I think DevForce did not create relation ..</div><div>Even I deleted tables from entity model and added again, I still don't see FK relations in model...</div><div>Is there any reason, why DevForce cannot add &nbsp;FK relations...</div><div>B.R.</div>]]>
   </description>
   <pubDate>Mon, 19 Nov 2012 00:30:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15238#15238</guid>
  </item> 
  <item>
   <title>SaveOptions : The most common problem are circular...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15229#15229</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3805<br /><strong>Posted:</strong> 16-Nov-2012 at 11:45am<br /><br />The most common problem are circular dependencies in your model. Table A has a non-nullable foreign key to table B, and table B has a non-nullable foreign-key to table A.&nbsp;<div><br></div><div>If you have a situation like that, the save will always fail, because you have created yourself a chicken or egg problem. You can't insert into table A, because the corresponding record in table B is missing and you can't insert into the table B, because the record in table A is missing, so EF can't determine a working save order.</div>]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 11:45:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15229#15229</guid>
  </item> 
  <item>
   <title>SaveOptions :   The PersistenceOrder property...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15224#15224</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3805<br /><strong>Posted:</strong> 16-Nov-2012 at 8:52am<br /><br />The PersistenceOrder property on SaveOptions is not actually used at this time.&nbsp;&nbsp; If you look at the Intellisense for it you'll see that we indicate it's for future use.&nbsp; So that explains why changing the PersisenceOrder has no effect.<div>&nbsp;</div><div>As to why the save is failing, that's hard to say without more information.&nbsp; The actual save to the database is handled by the EntityFramework, and EF uses the relationships in the entity model to determine save order.&nbsp; I would double check which entities are in the EntityManager, and also check the EDMX to see that the associations are set up correctly.&nbsp; If everything looks good, post the exception message here.</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 08:52:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15224#15224</guid>
  </item> 
  <item>
   <title>SaveOptions : Hi...I am developing a Windows...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15221#15221</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=243" rel="nofollow">cuneytgargin</a><br /><strong>Subject:</strong> 3805<br /><strong>Posted:</strong> 16-Nov-2012 at 8:26am<br /><br />Hi...<div>I am developing a Windows App.</div><div>When I press a button, I create 3 inventory items,</div><div>I use Inventory.Create method</div><div>like&nbsp;</div><div><div>public static Inventory Create(string barcode, int fixedAssetID, int departmentID, int locationID, int? supplierID, DateTime receiptDate, decimal? price, int? currencyID, decimal? currentValue, string invoiceNo, DateTime? invoiceDate, int warrantyPeriod, int inventoryStatusID, int? purchaseOrderDetailID, bool checkedOut, int? leasingID, string description, string inventoryKeywords, bool waitingInApprovals, int? PermanentLocationID, string markOrModel, int? insuranceID, int? expensePointID, decimal? currentPrice)</div><div>&nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Inventory aInventory = (Inventory)SessionParameters.Manager.CreateEntity(typeof(Inventory));</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SessionParameters.Manager.GenerateId(aInventory, Inventory.PropertyMetadata.InventoryID);</div></div><div>&nbsp; &nbsp;<span ="Apple-tab-span" style="white-space:pre">	</span>&nbsp;&nbsp;aInventory.SomeProperties are set</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>..</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>..</div><div>}</div><div><br></div><div>Then I create 3 InventoryStaffs for each inventory record...</div><div>I use InventoryStaff.Create Method like</div><div><div>public static InventoryStaff Create(int inventoryID, int staffID, int? priority, string description, bool? waitingInApprovals)</div><div>&nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; InventoryStaff aInventoryStaff = (InventoryStaff)SessionParameters.Manager.CreateEntity(typeof(InventoryStaff));</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SessionParameters.Manager.GenerateId(aInventoryStaff, InventoryStaff.PropertyMetadata.InventoryStaffID);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aInventoryStaff.InventoryID = inventoryID;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aInventoryStaff.StaffID = staffID;</div></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>...</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>...</div><div>}</div><div><br></div><div>then in my code..&nbsp;</div><div>I use</div><div>SaveOptions aSaceOption=new SaveOptions();</div><div><div>Type&#091;&#093; types = new Type&#091;&#093; { typeof(Inventory), typeof(InventoryStaff)};</div><div>aSaveOption.PersistenceOrder = types;</div><div>try</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SessionParameters.Manager.SaveChanges(aSaveOption);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Exception ex)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox.Show(ex.ToString());</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div></div><div><br></div><div><br></div><div>But code drops to Exception saying there is foreign key problem with the two tables...</div><div>I change their order in typeof line...</div><div>but it did not change...</div><div><br></div><div>How will I coordinate Entities saving order ?</div><div><br></div>]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 08:26:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3805&amp;PID=15221#15221</guid>
  </item> 
 </channel>
</rss>