MVC and Entity Framework : Unable to retrieve the metadata for the model

Let’s say you are developing an MVC application and you want to add a generated controller with the associated views.

You do this:

  1. Setting the controller’s name
  2. Choosing the template: mvc controller with read/write actions and views, using Entity Framework
  3. Choosing the model class
  4. Choosing the data context
  5. Clicking “Add”


It’s possible that you get this error:


The solution is quite simple:

Just go in the web.config file and comment the connection string


Then try again


It works!

Don’t forget to uncomment your connection string and you are done.

Incoming search terms:

  • unable to retrieve metadata for model class
  • MVCandEntityFramework:Unabletoretrievethemetadataforthemodel
  • unable to retrieve metadata for
  • unable to retrieve metadata for model
  • unable to retrieve metadata for mvc
  • unable to retrieve metadata
  • entity framework unable to retrieve metadata
  • asp net mvc unable to retrieve metadata
  • mvc unable to retrieve metadata
  • yhs-fullyhosted_003

Quick tip: list all poco’s properties and their values

Let’s say you have a poco and you want to list all its properties whith their values for debug purpose (or other purposes : logs, …)

You can write something like this :

string porperties = "property1 : " + this.property1;
porperties+="property : " + this.property2;
// ..
porperties+="propertyn : " + this.propertyn;

but it’s long and painful, plus you can forget some properties

The reflection can help us here :

string porperties = "";
 foreach (System.Reflection.PropertyInfo f in this.GetType().GetProperties())
porperties += f.Name + " : " + f.GetValue(this, null) + Environment.NewLine;

And if you want to be a bit clever, you create a base object and redefine the ‘ToString() method like this:

public class POCOBase
public override string ToString()
string ret = "";
foreach (System.Reflection.PropertyInfo f in this.GetType().GetProperties())
ret += f.Name + " : " + f.GetValue(this, null) + Environment.NewLine;
  return ret;

Then just inherit from POCOBase and call the ToString() method

The output should be something like this :

AccountID : 10
ExternalREF : 090xfe
PHONE : 00044440000
RegisterDate : 30/09/2009 16:20:02
Remark :

I think it’s quick, easy and useful

Visual Studio Default Key binding posters

Update 2015 : if you are looking for the 2012, 2013 or 2015 version : you can check this site :

The visual studio 2010 keybinding poster is available since a few weeks.

Visual C# 2010 default key bindings preview :



Shortcuts are grouped by category (debuging, refactoring, editing, navigation, …)

Here is the Visual Studio Keyboard shortcuts posters for C#:

Visual Studio 2010

Visual Studio  2008

Visual Studio 2005

Enjoy them !

Incoming search terms:

  • Visual Studio 2013 Keybinding Posters
  • Visual Studio 2012 Keybinding Posters
  • visual studio 2013 shortcuts poster
  • visual studio 2012 shortcuts
  • visual studio 2012 keybinding poster
  • visual studio 2013 default key bindings
  • visual c# 2013 keybinding reference poster
  • visual studio 2013 keybinding poster
  • microsoft visual 2103 c# default key bindings
  • microsoft visual 2012 c# default key bindings

First use of Visual Studio 2010 : the installation

Yesterday I received a visual studio 2010 Ultimate edition from work.

I’ve already test the  express edition when it was in beta phase, but it’s not the same …

So, let’s install it !

I install it on a Fujitsu Siemens laptop with 4 GB Ram and a Intel Core 2 Duo processor (2,53 GHz) running  Windows 7 64 bit Ultimate edition.



Launch the auto run program


Loading screen


Click Next


Read and accept the license terms


Choose your installation mode : Full installation (takes more than 6 GB) or Custom installation


I choose Custom


Select the features you want :


(notice that “Microsoft SharePoint Developer Tools” are integrated)

I just don’t want Dotfuscator community to be installed, so I uncheck  it

I keep the rest because I want to test some features


Click Install

Installation running :


After less than 10 minutes, the installation asked me to restart my computer:



I click “Restart Now”


When restarting, a loading form is showing


Then the setup continue


After about 45 minutes, the setup is finished


You can choose to install the documentation, but I choose to click on the “Finish” button.


The installation windows appears :


I Click Exit

Visual Studio 2010 is now installed


The installation takes me about one hour, and no problem occurred.

Now I can launch the product





I choose my default environment settings (I used to choose Visual C# Development settings so I pick this one).


I Click on “Start Visual Studio”

First time loading form



Visual studio is up and running



Help and documentation are on the start page:

A What’s new section is available on the start page :

Some other links are available :

  • Creating application with Visual Studio
  • Extending Visual Studio
  • Community and Learning Resources


Some resources for Windows, Web, Cloud, Office,SharePoint and Data development are accessible too.


Next step : migration of a Visual studio 2008 solution !

Incoming search terms:

  • Choose Default Environment Settings
  • first developed Fujitsu Siemens laptops
  • first use of visual studio installing
  • ideal settings for visual studio 2010 on first use