I'm using Entity Framework 4.0 with MySQL.
This is my code:
using (Entities myEntities = new Entities(dataAccess.GetConnectionString()))
{
student sObj = new student();
sObj.id = stud.id;
sObj.rollNo = stud.rno;
sObj.key = (Int64)stud.key;
myEntities.student.AddObject(sObj);
myEntities.SaveChanges();
long maxId = (from f in myEntities.student select f.id).Max();
logger.Info("maxId: " + maxId);
}
I'm getting new maxId
every time, niot getting any errors. But when I see database, no rows getting added. And this is happening only with this table. Working fine for all other tables.
尝试将其标记为已修改
EntityState.Modified
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.