We have a web application which creates a new table in SQL Server during a particular administration function. When I query this table using Simple.Data in an other part of the application I receive an
unresolvableobjectexception
as if Simple.Data cannot see this new table.
I have confirmed this is not a database permissions issue.
The behaviour I can see is that if I recycle the application pool then Simple.Data starts to work. This would indicate that a singleton/cache has been refreshed.
Is anyone aware of a mechanism to update the Simple.Data cache through code to achieve the same affect as the recycle.
I am using the
FindAllBy
syntax in Simple.Data.
After some investigation I discovered that there is a method on the adapter object which will clear the cache and this gets reinitialized automatically. Just call
DatabaseSchema.ClearCache();
Also Mark Rendle pointed me to the method which does the same thing
Database.ClearAdapterCache();