I have created a class which models my existing table in MySql database. Below is the class:
public class class1
{
[Key]
public int id { get; set; }
public int LastName { get; set; }
public int FirstName { get; set; }
}
I have also created a this class.
public class Dbo : DbContext
{
public DbSet<class1> Classs { get; set; }
}
I have created my controller. Now when I run the application, I get this error:
MySql.Data.MySqlClient.MySqlException was unhandled by user code
Message=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`LastName` int NOT NULL,
`Fi' at line 2
Source=MySql.Data
ErrorCode=-2147467259
Number=1064
MySql table has this structure:
`id` int(11) NOT NULL,
`LastName` int(11) NOT NULL,
`FirstName` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT