Skip to main content

Posts

Showing posts from March, 2011

EF CodeFirst Database.SetInitializser Requires Connection to 'master' Database Error

One of the features of EF CodeFirst is the ability to automatically drop and recreate a database if the model changes or if the database does not exist, which is pretty useful when just doing development work. In a web app this is done in the Global.asax file within "protected void Application_Start()" as per this post from Scott Guthrie -  http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx . An example would be: protected void Application_Start() { Database.SetInitializer<yourdbcontex>(new DropCreateDatabaseIfModelChanges<yourdbcontext>()); AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); } However when using the Database.SetInitializer and trying to rebuild the database, the following exception may be encountered, especially if using SQL Server Express: "This operation requires a connection to the 'master'

Entity Framework Code-First Learning Resources

Some resources to help learn and understand Microsoft's Entity Framework Code-First ORM. Basic Tutorial http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part1-cs Advanced Tutorial http://www.asp.net/mvc/tutorials/mvc-music-store-part-1 Blog posts with further hints and tips http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx Update to NerdDinner using EF Code-First. Also shows how to synchronise database with the model and seeding database with initial data. http://www.hanselman.com/blog/SimpleCodeFirstWithEntityFramework4MagicUnicornFeatureCTP4.aspx Some useful info demonstrating Data Annotations such as [Key] and [Required]. This post will be added to as time goes by. If there are any other good resources about this MS framework feel free to throw them in to a comment. Updates EF Feature CTP5: Code First Walkthrough http://blogs.msdn.com/b/adonet/archive/2010/12/06/ef-feature-ctp5-code-first-walkthrou

Mounting and Reading ISO Files

An ISO image (International Organization for Standardization) is an archive file (also known as a disc image) of an optical disc, composed of the data contents of every written sector of an optical disc, including the optical disc file system. From  http://en.wikipedia.org/wiki/ISO_image  08/03/2011 Basically an ISO image, in layman's terms, is the file on a CD-ROM or DVD. ISO images can be downloaded and saved onto a CD or DVD and run as usual. Alternatively they can be virtually mounted without the need to burn the image to disc. Some Linux systems have this capability built in. For Windows, you can download some freebie software (or pay for it). A couple of free options are: DAEMON Tools Lite -  http://www.daemon-tools.cc/eng/products/dtLite SlySoft Virtual Clone Drive -  http://www.slysoft.com/en/virtual-clonedrive.html Once this software is downloaded and installed, the ISO image can be selected and "mounted" virtually, which will run the image as though i