System.ArgumentNullException in entity framework -


here's dbcontext. can see, tables in database 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 code generates system.argumentnullexception: value cannot null. parameter name: source.

using (var db = new datacontext()) {     var x = db.personer.count(); } 

personer must property not field.

public class datacontext : dbcontext {     public datacontext() : base("name=connstring") { }      public dbset<person> personer { get; set; } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -