Relation Cache - Scope
In this video we discuss the scope of Cache for a relation and how to extend it
public class DemoCache : BusinessProcessBase
{
public DemoCache()
{
Entities.Add(new Models.Shippers());
}
protected override void OnStart()
{
for (int i=0; i < 10; i++)
{
- new Child().Run();
Cached<Child>().Run();
}
Exit();
}
public class Child : BusinessProcessBase
{
Models.Shippers Shippers = new Models.Shippers()
{
Cache = true
, KeepCacheAliveAfterExit = true
}
}
}
Steps:
- Replace
new
withCached
on the call. - Add
KeepCacheAliveAfterExit = true
to the Entities you want to cache - Add the entity that you want to cache - to the parent controller you want to cache it in using
Entities.Add
- It doesn't have to be the direct parent, it can be 1 ore more levels up in the stack (grand parent etc...)
- If the entity is already in use in the parent (in a
From
or aRelations.Add
) , you don't need to add it again
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com