当我尝试添加新学生但学生不为空时,我得到的对象引用未设置为对象的实例。
我正在尝试使用entity创建mysql db:
Set my_Element = driver.FindElementsByXPath("(//th[strong='My text'])[1]/../../../tbody/tr[1]/td[2]")
堆栈跟踪
static void Main(string[] args)
{
using (var db =new MySqlTest())
{
var s = new Student() {id = 1,num = 9};
db.Student.Add(s);
db.SaveChanges();
}
}
public class Student
{
[Key]
public long id { get; set; }
public long num { get; set; }
}
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
public class MySqlTest : DbContext
{
public DbSet<Student> Student { get; set; }
}