Here's my DbContext. As you can see, the tables in database are named differently.
public class DataContext : DbContext {
public DataContext() : base("name=connString") { }
public DbSet<Person> Personer;
}
[Table("Users")]
public class Person {
[Column("UserID")]
public int ID { get; set; }
[Column("UserFirstName")]
public string Fornavn { get; set; }
[Column("UserLastName")]
public string Etternavn { get; set; }
}
Here's the code that generates System.ArgumentNullException: Value cannot be null. Parameter name: source.
using (var db = new DataContext()) {
var x = db.Personer.Count();
}
Personerget initialized with a value? The exception is telling you that it'snull.