Tuesday, April 8, 2014

Update Using Entity Framework

  1. Use the following method as a reference to update the record in Table using Entity Framework.

    public bool UpdateEventLog(tbl_M_EventLog objNewEventLog)
    {
        bool status = false;
        try
        {
        tbl_M_EventLog objEventLog = DBConnection.Entities.tbl_M_EventLog.SingleOrDefault(p => p.EventId == objNewEventLog.EventId);
        DBConnection.Entities.ObjectStateManager.ChangeObjectState(objEventLog, System.Data.EntityState.Modified);
        DBCommon.ReflectSingleData(objEventLog, objNewEventLog, true);
        DBConnection.Entities.SaveChanges();
        DBConnection.SaveChanges();
        status = true;
        }
        catch (Exception ex)
        {
       
        }
        return status;
    }

1 comment:

  1. Hi! It would seem that the author of this blog is truly extremely proficient in light of the fact that I never read such sort of composing. The method for composing and the method for utilizing right words on correct place demonstrates some master abilities kickass proxy

    ReplyDelete