<?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 : Database First</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Database First</description>
  <pubDate>Fri, 10 Apr 2026 19:27:10 -700</pubDate>
  <lastBuildDate>Sat, 17 Nov 2012 08:03:40 -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=3804</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>Database First : I just pulled down the latest...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15233#15233</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1590" rel="nofollow">brian.shirley</a><br /><strong>Subject:</strong> 3804<br /><strong>Posted:</strong> 17-Nov-2012 at 8:03am<br /><br />I just pulled down the latest from NuGet and it is working perfectly. &nbsp;<span style="line-height: 1.4;">Thanks again for the quick turnaround. &nbsp;Stellar.</span>]]>
   </description>
   <pubDate>Sat, 17 Nov 2012 08:03:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15233#15233</guid>
  </item> 
  <item>
   <title>Database First : There is a new Breeze version...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15232#15232</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1524" rel="nofollow">jtraband</a><br /><strong>Subject:</strong> 3804<br /><strong>Posted:</strong> 17-Nov-2012 at 3:09am<br /><br />There is a new Breeze version 0.71.3 available now that should fix this issue. <br><br>With this version, you should be able to create an EFContextProvider with a "Database First" DbContext .<br><br><br>]]>
   </description>
   <pubDate>Sat, 17 Nov 2012 03:09:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15232#15232</guid>
  </item> 
  <item>
   <title>Database First : I created a simple database first...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15228#15228</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1590" rel="nofollow">brian.shirley</a><br /><strong>Subject:</strong> 3804<br /><strong>Posted:</strong> 16-Nov-2012 at 11:30am<br /><br /><div>I created a simple database first model that uses ObjectContext as a test and it worked as stated, so progress!!</div><div><br></div><div>Thank you very much for the quick responses on this and all of the hard work on Breeze.</div><div><br></div><div><br></div><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by jtraband</strong></em><br /><br />Ok, I think I understand what is happening.&nbsp; <br><br>Our internal tests are all built against "Database first" models built several years ago with an "ObjectContext".&nbsp; With the advent of EF 4.1, EF "Database first" now defaults to creating a context that derives from DbContext and uses POCO entity classes.&nbsp; We need to add tests for this, because evidently the DbContext that EF4.1 creates for "Database first" models is subtly different from that created for CodeFirst models, where we have a number of tests. <br><br>We will try to have this cleared up and a patch put together by this evening.&nbsp; But until then, you can still use an "old" ObjectContext by following the instructions in this link.<br><br><a href="http://msdn.microsoft.com/en-us/data/jj556581.aspx" target="_blank">msdn.microsoft.com/en-us/data/jj556581.aspx</a></td></tr></table>]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 11:30:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15228#15228</guid>
  </item> 
  <item>
   <title>Database First :  Ok, I think I understand what...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15227#15227</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1524" rel="nofollow">jtraband</a><br /><strong>Subject:</strong> 3804<br /><strong>Posted:</strong> 16-Nov-2012 at 11:22am<br /><br />Ok, I think I understand what is happening.&nbsp; <br><br>Our internal tests are all built against "Database first" models built several years ago with an "ObjectContext".&nbsp; With the advent of EF 4.1, EF "Database first" now defaults to creating a context that derives from DbContext and uses POCO entity classes.&nbsp; We need to add tests for this, because evidently the DbContext that EF4.1 creates for "Database first" models is subtly different from that created for CodeFirst models, where we have a number of tests. <br><br>We will try to have this cleared up and a patch put together by this evening.&nbsp; But until then, you can still use an "old" ObjectContext by following the instructions in this link.<br><br><a href="http://msdn.microsoft.com/en-us/data/jj556581.aspx" target="_blank">msdn.microsoft.com/en-us/data/jj556581.aspx</a>]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 11:22:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15227#15227</guid>
  </item> 
  <item>
   <title>Database First : I switched to the annotation for...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15226#15226</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1590" rel="nofollow">brian.shirley</a><br /><strong>Subject:</strong> 3804<br /><strong>Posted:</strong> 16-Nov-2012 at 11:11am<br /><br /><div>I switched to the&nbsp;&#091;AcceptVerbs("GET")&#093; annotation for good measure and still no luck.</div><div><br></div><div>I'm wondering if the conflict is due to the fact that my Database First &nbsp;EDMX model is generating a class derived from DbContext rather than ObjectContext due to the DbContext generator template I linked to above. &nbsp;I went this route in order to get true POCOs and DbSet&lt;T&gt; with DbContext API. &nbsp;</div><div><br></div><div>I will try to do a traditional database first example that derives from ObjectContext to see if I still get issues.</div><div><br></div><div>Have you tried any examples this way?</div><div><br></div><div>For reference,&nbsp;<span style="line-height: 1.4;">Error:</span></div>Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 11:11:08 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15226#15226</guid>
  </item> 
  <item>
   <title>Database First : Hm, we have several test cases...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15225#15225</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1524" rel="nofollow">jtraband</a><br /><strong>Subject:</strong> 3804<br /><strong>Posted:</strong> 16-Nov-2012 at 10:49am<br /><br />Hm,&nbsp; we have several test cases that use Database first models.<br><br>The EFContextProvider&lt;T&gt; generic argument "T" can be either a DbContext or an ObjectContext.&nbsp; <br><br>So with EF "Database first",&nbsp; you should have an EFContext class that looks something like.<br><br>&nbsp;&nbsp;&nbsp; public partial class <i><b>NorthwindIBContext </b></i>: ObjectContext {<br>&nbsp;&nbsp;&nbsp; ...<br><br>&nbsp;&nbsp;&nbsp; }<br><br>The Breeze EFContextProvider can then be used like this<br><br><br>&nbsp;&nbsp;&nbsp; public class NorthwindIBContextProvider: EFContextProvider&lt;<i><b>NorthwindIBContext</b></i>&gt;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public NorthwindContextProvider() : base() { }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; // any public override here like BeforeSaveEntity or BeforeSaveEntities... <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br><br>And then your api controller might look something like this<br><br>&nbsp; &nbsp; public class NorthwindIBModelController : ApiController {<br><br>&nbsp; &nbsp; &nbsp; &nbsp; private&nbsp; NorthwindContextProvider _contextProvider = new NorthwindContextProvider();<br><br><i><b>&nbsp; &nbsp; &nbsp; &nbsp; &#091;AcceptVerbs("GET")&#093;</b></i><br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; public String Metadata() {<br>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; return _contextProvider.Metadata();<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br>&nbsp; &nbsp; }<br><br>Also, note that the example above uses an <b>&#091;AcceptVerbs("Get")&#093;</b> attribute instead of an<b> &#091;HttpGet&#093; </b>attribute.&nbsp; I'm not really clear on the distinction between these two, but just to be safe ... <br><br>If this doesn't work, let me know and I'll try to post an entire working example with an DataBase first model.<br>]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 10:49:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15225#15225</guid>
  </item> 
  <item>
   <title>Database First :  I am also encountering this...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15223#15223</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1590" rel="nofollow">brian.shirley</a><br /><strong>Subject:</strong> 3804<br /><strong>Posted:</strong> 16-Nov-2012 at 8:42am<br /><br />I am also encountering this exact same problem. &nbsp;<div><br></div><div>I created an EDMX file with one table from an existing database. &nbsp;I then used the <a href="http://visualstudiogallery.msdn.microsoft.com/da740968-02f9-42a9-9ee4-1a9a06d896a2" target="_blank">DbContext generator</a> template so that the model used DbContext rather than ObjectContext and generated a POCO.<div><br></div><div>When calling directly via a WebApi method such as below, I receive JSON data as expected.</div><div><br></div><div><div>BrokerCommContext DbContext = new BrokerCommContext();</div><div>return DbContext.CommissionDesignations.AsEnumerable();</div><div><br></div><div>However, when invoking the method from the EFContextProvider I receive the same error as identified by Mike in the original post.</div><div><div><br></div><div>readonly EFContextProvider&lt;BrokerCommContext&gt; _contextProvider =</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new EFContextProvider&lt;BrokerCommContext&gt;();</div></div><div><div><span ="Apple-tab-span" style="white-space:pre">	</span>&#091;HttpGet&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public string Metadata()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return _contextProvider.Metadata();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div></div><div><br></div><div>I am really looking forward to getting Breeze out there with this project. &nbsp;Any help is greatly appreciated!</div><div><br></div><div>Code Generated from EDMX</div><div><div>&nbsp;public partial class BrokerCommContext : DbContext</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public BrokerCommContext()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : base("name=BrokerCommContext")</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Configuration.LazyLoadingEnabled = false;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; protected override void OnModelCreating(DbModelBuilder modelBuilder)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new UnintentionalCodeFirstException();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public DbSet&lt;CommissionDesignation&gt; CommissionDesignations { get; set; }</div><br> <table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by mike963</strong></em><br /><br />Hi<div></div><div>I have tried Breeze with an existing EF implementation that was developed DB first.</div><div></div><div>I get an error&nbsp;_contextProvider.Metadata();</div><div></div><div>Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.</div><div></div><div>Originally I had the EDMX file in a separate Data Access Layer but have also tried it locally but still get same error</div><div></div><div>Any advice ?</div><div></div><div>Stack Trace</div><div></div><div><div>&nbsp; &nbsp;at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)</div><div>&nbsp; &nbsp;at Breeze.WebApi.EFContextProvider`1.GetCsdlFromDbContext(DbContext dbContext)</div><div>&nbsp; &nbsp;at Breeze.WebApi.EFContextProvider`1.GetJsonMetadataFromDbContext(DbContext dbContext)</div><div>&nbsp; &nbsp;at Breeze.WebApi.EFContextProvider`1.Metadata()</div><div>&nbsp; &nbsp;at UsingBreeze.Controllers.BreezeSampleController.Metadata() in d:\ModuleChooser\UsingBreeze\Controllers\BreezeSampleController.cs:line 19</div><div>&nbsp; &nbsp;at lambda_method(Closure , Object , Object&#091;&#093; )</div><div>&nbsp; &nbsp;at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.&lt;&gt;c__DisplayClass13.&lt;GetExecutor&gt;b__c(Object instance, Object&#091;&#093; methodParameters)</div><div>&nbsp; &nbsp;at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object&#091;&#093; arguments)</div><div>&nbsp; &nbsp;at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.&lt;&gt;c__DisplayClass5.&lt;ExecuteAsync&gt;b__4()</div><div>&nbsp; &nbsp;at System.Threading.Tasks.TaskHelpers.RunSynchronously&#091;TResult&#093;(Func`1 func, CancellationToken cancellationToken)</div></div></td></tr></table> </div></div></div><span style="font-size:10px"><br /><br />Edited by brian.shirley - 16-Nov-2012 at 9:09am</span>]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 08:42:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15223#15223</guid>
  </item> 
  <item>
   <title>Database First : HiI have tried Breeze with an...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15220#15220</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1589" rel="nofollow">mike963</a><br /><strong>Subject:</strong> 3804<br /><strong>Posted:</strong> 16-Nov-2012 at 7:58am<br /><br />Hi<div><br></div><div>I have tried Breeze with an existing EF implementation that was developed DB first.</div><div><br></div><div>I get an error&nbsp;_contextProvider.Metadata();</div><div><br></div><div>Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.</div><div><br></div><div>Originally I had the EDMX file in a separate Data Access Layer but have also tried it locally but still get same error</div><div><br></div><div>Any advice ?</div><div><br></div><div>Stack Trace</div><div><br></div><div><div>&nbsp; &nbsp;at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)</div><div>&nbsp; &nbsp;at Breeze.WebApi.EFContextProvider`1.GetCsdlFromDbContext(DbContext dbContext)</div><div>&nbsp; &nbsp;at Breeze.WebApi.EFContextProvider`1.GetJsonMetadataFromDbContext(DbContext dbContext)</div><div>&nbsp; &nbsp;at Breeze.WebApi.EFContextProvider`1.Metadata()</div><div>&nbsp; &nbsp;at UsingBreeze.Controllers.BreezeSampleController.Metadata() in d:\ModuleChooser\UsingBreeze\Controllers\BreezeSampleController.cs:line 19</div><div>&nbsp; &nbsp;at lambda_method(Closure , Object , Object&#091;&#093; )</div><div>&nbsp; &nbsp;at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.&lt;&gt;c__DisplayClass13.&lt;GetExecutor&gt;b__c(Object instance, Object&#091;&#093; methodParameters)</div><div>&nbsp; &nbsp;at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object&#091;&#093; arguments)</div><div>&nbsp; &nbsp;at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.&lt;&gt;c__DisplayClass5.&lt;ExecuteAsync&gt;b__4()</div><div>&nbsp; &nbsp;at System.Threading.Tasks.TaskHelpers.RunSynchronously&#091;TResult&#093;(Func`1 func, CancellationToken cancellationToken)</div></div>]]>
   </description>
   <pubDate>Fri, 16 Nov 2012 07:58:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3804&amp;PID=15220#15220</guid>
  </item> 
 </channel>
</rss>