<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Adding a New Field to the Movie Model and Database Table</title><link>http://asp.net</link><pubDate>Wed, 08 May 2013 15:37:56 GMT</pubDate><generator>umbraco</generator><description>Comments for Adding a New Field to the Movie Model and Database Table</description><language>en</language><atom:link href="http://asp.net/rss/comments/27664" rel="self" type="application/rss+xml" /><item><title>Comment Posted by rsmachado</title><link>http://asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/vb/adding-a-new-field</link><pubDate>Thu, 12 May 2011 10:10:02 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000013142</guid><description><![CDATA[ <p>Hi,</p><p>I’m trying to follow this tutorial, but the script for the “MovieInitializer”.</p><p>There is an error with the script in the tutorial, because it doesn’t work at all.</p><p>Please, should be possible to publish a fix?</p><p>Thanks in advance,</p><p>Ricardo</p><p>example: instead &quot;using&quot;, should be &quot;imports&quot;?</p><p>In my sample, there is 24 errors: declaratio expected, syntax, end of statment expected, etc.!</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/rsmachado.jpg?forceidenticon=false&amp;dt=635049954000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by Justin Aurand</title><link>http://asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/vb/adding-a-new-field</link><pubDate>Thu, 26 May 2011 10:42:48 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000013279</guid><description><![CDATA[ <p>The MovieInitializer is in C# rather than VB. This is also the case with a cope snippet on the prior page of this tutorial.</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/Justin%20Aurand.jpg?forceidenticon=false&amp;dt=635049954000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by asim.m</title><link>http://asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/vb/adding-a-new-field</link><pubDate>Fri, 27 May 2011 15:48:55 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000013294</guid><description><![CDATA[ <p>Imports System </p><p>Imports System.Collections.Generic </p><p>Imports System.Data.Entity </p><p> </p><p>Namespace MvcMovie.Models </p><p>    Public Class MovieInitializer </p><p>        Inherits DropCreateDatabaseIfModelChanges(Of MovieDBContext) </p><p>        Protected Overrides Sub Seed(ByVal context As MovieDBContext) </p><p>            Dim movies = New List(Of Movie) From { </p><p>             New Movie With {.Title = &quot;When Harry Met Sally&quot;, .ReleaseDate = Date.Parse(&quot;1989-1-11&quot;), .Genre = &quot;Romantic Comedy&quot;, .Rating = &quot;R&quot;, .Price = 7.99D}, </p><p>             New Movie With {.Title = &quot;Ghostbusters &quot;, .ReleaseDate = Date.Parse(&quot;1984-3-13&quot;), .Genre = &quot;Comedy&quot;, .Rating = &quot;R&quot;, .Price = 8.99D}, </p><p>             New Movie With {.Title = &quot;Ghostbusters 2&quot;, .ReleaseDate = Date.Parse(&quot;1986-2-23&quot;), .Genre = &quot;Comedy&quot;, .Rating = &quot;R&quot;, .Price = 9.99D}, </p><p>             New Movie With {.Title = &quot;Rio Bravo&quot;, .ReleaseDate = Date.Parse(&quot;1959-4-15&quot;), .Genre = &quot;Western&quot;, .Rating = &quot;R&quot;, .Price = 3.99D}} </p><p> </p><p>            movies.ForEach(Function(d) context.Movies.Add(d)) </p><p>        End Sub </p><p>    End Class </p><p>End Namespace</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/asim.m.jpg?forceidenticon=false&amp;dt=635049954000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by wankwongho</title><link>http://asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/vb/adding-a-new-field</link><pubDate>Wed, 15 Jun 2011 11:38:15 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000013516</guid><description><![CDATA[ <p>Thank you for the coding of VB version. =)</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/wankwongho.jpg?forceidenticon=false&amp;dt=635049954000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by cesar.saccone</title><link>http://asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/vb/adding-a-new-field</link><pubDate>Tue, 21 Jun 2011 16:30:29 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000013577</guid><description><![CDATA[ <p>asim.m, you are the man. thanks a lot, I was seriously considering looking for another tutorial.</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/cesar.saccone.jpg?forceidenticon=false&amp;dt=635049954000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by boocoder</title><link>http://asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/vb/adding-a-new-field</link><pubDate>Tue, 12 Jul 2011 11:08:16 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000013748</guid><description><![CDATA[ <p>For situations in which I don&#39;t want to use database initialization and favour the second option...how do I have to change the database schema? I tried right-clicking the movies table en change schema (adding a column) but I keep getting an out of sync error. I removed the EdmMetadata table, it now works but seems kind of radical to me having now syncing table anymore ;).</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/boocoder.jpg?forceidenticon=false&amp;dt=635049954000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by Machello</title><link>http://asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/vb/adding-a-new-field</link><pubDate>Wed, 27 Jul 2011 01:10:38 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000013857</guid><description><![CDATA[ <p>I would also like to know how to pursue the second method of updating the database schema manually and then generating a new ModelHash to plug into the EdmMetadata ModelHash column.</p><p></p><p></p><p>If you want use the first method yet preserve the data, I would think that you could somehow back it up to a temporary table, then run the database initialization code and instead of using the seed values, somehow repopulate with the data from the second table, using default values for any added columns.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/Machello.jpg?forceidenticon=false&amp;dt=635049954000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by DanR_Qc</title><link>http://asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/vb/adding-a-new-field</link><pubDate>Wed, 08 May 2013 15:37:56 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000019072</guid><description><![CDATA[ <p>I also had the out of sync error when using the second method, after having updated the db schema by adding the rating column. To avoid this, disable the db initializer by putting this call in the context class&#39; constructor (my example is in vb):</p><p></p><p>Entity.Database.SetInitializer(Of MovieDBContext)(Nothing)</p><p></p><p>HTH</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/DanR_Qc.jpg?forceidenticon=false&amp;dt=635049954000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>