Welcome...



...All those moments will be lost in time, like tears in rain....

- soliloquy from Blade Runner


Bits and bytes do get lost, awash in the rain of data flow that is Internet. They slip away from us, never to found again... some of them will be captured here, many more will not... like tears in rain...



Monday, April 1, 2013

Entity Framework 5 and LocalDb in Visual Studio 2012


 Visual Studio 2012 introduced LocalDb - special edition of SQL Express for developers.

 Problem that I run into when trying to create database was that by default, web.config had SQLExpress datasource specified, not LocalDb.

 After searching and finding a great blog - OdeToCode, turned out that I had to change this section:

<entityFramework>
  <defaultConnectionFactory 
      type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, 
            EntityFramework">
    <parameters>
      <parameter value="v11.0" />
    </parameters>
  </defaultConnectionFactory>
</entityFramework> 

I did change defaultConnectionFactory, but it didn't work, giving me error about not recognizing LocalDbConnectionFactory etc.

Additional parameter has to be added and to be v11.0 for this to work.

No comments:

Post a Comment