<?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 : Where is OracleIdGenerator?</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Where is OracleIdGenerator?</description>
  <pubDate>Sat, 11 Apr 2026 22:36:59 -700</pubDate>
  <lastBuildDate>Tue, 09 Jun 2009 07:27:12 -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=1304</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>Where is OracleIdGenerator? : I wish I had known I was completely...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1304&amp;PID=4734#4734</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1304<br /><strong>Posted:</strong> 09-Jun-2009 at 7:27am<br /><br />I wish I had known I was completely barking up the wrong tree.  There is no need to use an IdGenerator.<br /><br />To use an Oracle Sequence in DevForceEF (Silverlight or Windows):<br /><br />1) Add a BEFORE INSERT trigger to the table to get the sequence value and put it into the Id column.  This will then work in a way similar to a SQL Server identity column.<br />i.e.:<br />create or replace trigger DEAL_BI_GETSEQ <br />before insert on deal FOR EACH ROW when (NEW.DEAL_ID is null) <br />BEGIN select DEAL_ID_SEQ.nextval into :NEW.DEAL_ID from dual; end;<br /><br />2) Edit the XML in the Entity Model's .edmx file to add the StoreGeneratedPattern attribute to the key's Property element.<br />i.e.:<br />&lt;EntityType Name="DEAL"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Key&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;PropertyRef Name="DEAL_ID" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Key&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Property Name="DEAL_ID" Type="int64" Nullable="false" <strong>StoreGeneratedPattern="Identity"</strong> /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Property Name="DATE_ENTERED" Type="DATE" Nullable="false" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Property Name="DATE_OF_DEAL" Type="DATE" Nullable="false" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Property Name="FLOW_DATE_START" Type="DATE" Nullable="false" /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Property Name="FLOW_DATE_END" Type="DATE" Nullable="false" /&gt;<br /><br />Now, EF will automagically pick up the new ID and update the item.  A unit test like this will show that:<br />&#091;TestMethod&#093;<br />public void AddADeal()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;ServerModelEF.ModelEntities em = new ModelEntities();<br />&nbsp;&nbsp;&nbsp;&nbsp;Deal deal = new Deal();<br />&nbsp;&nbsp;&nbsp;&nbsp;long id = deal.DealId;<br />&nbsp;&nbsp;&nbsp;&nbsp;em.AddToDeals(deal);<br />&nbsp;&nbsp;&nbsp;&nbsp;int result = em.SaveChanges();<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.IsTrue(result&gt;0);<br />&nbsp;&nbsp;&nbsp;&nbsp;Assert.AreNotEqual(id, deal.DealId);<br />}  ]]>
   </description>
   <pubDate>Tue, 09 Jun 2009 07:27:12 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1304&amp;PID=4734#4734</guid>
  </item> 
  <item>
   <title>Where is OracleIdGenerator? : You can use the same algorithms...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1304&amp;PID=4722#4722</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 1304<br /><strong>Posted:</strong> 08-Jun-2009 at 9:37am<br /><br />You can use the same algorithms used in DevForce Classic.&nbsp; I will email you the documentation used in this tutorial.]]>
   </description>
   <pubDate>Mon, 08 Jun 2009 09:37:32 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1304&amp;PID=4722#4722</guid>
  </item> 
  <item>
   <title>Where is OracleIdGenerator? : I am using DevForce Silverlight....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1304&amp;PID=4711#4711</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=308" rel="nofollow">skingaby</a><br /><strong>Subject:</strong> 1304<br /><strong>Posted:</strong> 04-Jun-2009 at 12:45pm<br /><br />I am using DevForce Silverlight.  What do I need to do to get the business object Id's out of an Oracle Sequence?<br />Thanks,<br />Simon]]>
   </description>
   <pubDate>Thu, 04 Jun 2009 12:45:41 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1304&amp;PID=4711#4711</guid>
  </item> 
 </channel>
</rss>