Skip to main content
1 of 2
Tamás Tárnok
  • 4.3k
  • 1
  • 20
  • 33

As you said that it looks like it gets the web database not the master. If you post the whole GetLayoutItem<T>() methond then I can add a more precise answer, but it looks like that something wrong in that method.

###Possible reason

I assume that you initialize somewhere an ISitecoreContext object and you use the GetItem<T>() method of ISitecoreContext. Could be that you initialize it as a Singleton if you are using IOC. But it should be at least LifestylePerWebRequest because if you call the new SitecoreContext() without parameters then it's using the context database. So if it's a Singleton then it uses always that database which was the context initially.

These are just assumptions but could be helpful if you have this case.

Tamás Tárnok
  • 4.3k
  • 1
  • 20
  • 33