I am using SimpletInjector
to inject the entity framework
context in controller using following code:
private static void Initializer(Container container)
{
container.RegisterSingle<IDbContext, SpotterContext>();
container.RegisterSingle<IUnitOfWork, UnitOfWork>();
}
I am using the injected context to execute stored procedure which will have only UPDATE
or DELETE
statements using the following code:
context.Database.ExecuteSqlCommand(<spname>, <params array>);
The problem I am facing is that the changes made by the stored procedure in database are not getting reflected in the context and when accessing the updated data using the context, I am getting the old data and not the updated data.
How to update the context
after executing a stored procedure to get latest data from database?