I am trying to create database using Code First approach. When I run the following code I am getting the following exception. Is there anything wrong in the fields that I de
@Slauma's answer is the right one - the tables are created upon initialization. It's probably easiest to just delete the database and let EF create it (if you leave your connection string as is, it will create a database called LibraryReservationSystem on the local machine; you should probably specify an explicit host name if you're going to use the connection string in the config at this point).
You would need something along the lines of:
public class NerdDinnersInitializer : DropCreateDatabaseIfModelChanges { }
And you would also need to set the initializer in your Main method:
Database.SetInitializer(new NerdDinnersInitializer());
Word to the wise: NEVER deploy an application with an initializer like the one above. You can see this blog post about how to control initializers via the config file for more details on how to control this in production applications.