My project is a Web project for MVC4 and I am trying to add a controller after adding a connection string to the web.config folder, but every time i try to add it, i get the following message:
Unable to retrieve metadata for TestFFL14.Models.LivePlayers. Object Reference not set to an instance of an object
Here is the LivePlayers Model:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
namespace TestFFL14.Models
{
public class LivePlayers
{
public int ID { get; set; }
public int Nid { get; set; }
public string Plyr { get; set; }
public string Team { get; set; }
public DateTime DateAdded { get; set; }
public DateTime DateUpdated { get; set; }
}
public class LivePlayersDBContext : DbContext
{
public DbSet<LivePlayers> Players { get; set; }
}
}
I am trying to use this connection string but not having any success:
<add name="LivePlayersDBContext" connectionString="Server=127.0.0.1;Port=5432;Database=testdb;User Id=pkioko;Password=stunner1" providerName="Npgsql" />
What am i doing wrong?