Raw query changes does not appeared in Entity Object c#

Viewed 67

I've using raw query for update status of a column but after update, changes not appeared in Entity Object:

CDIMDEntities oDB = new CDIMDEntities();
SystemYear oSY = oDB.SystemYears.FirstOrDefault(x => x.Year == Year);
if (oSY != null)
{
    string thsQuery = "UPDATE SystemYears SET  " + Column + " = {0} WHERE Id = {1}";
    oDB.Database.ExecuteSqlCommand(thsQuery, Status, oSY.Id);
    //After this changes appeared in database 
    // But when again when trying get object ,It's showing old values 
    oSY = oDB.SystemYears.FirstOrDefault(x => x.Id == oSY.Id);
    this.SystemYearRep.SaveSystemYear(oSY);
}
2 Answers
Related