aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-27 16:49:42 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-27 16:49:42 +0200
commit2ab54573d10ca59351100ab8416178be2223fc91 (patch)
tree9a5077998e301c1e86cf00b07ea98eca501fc4a8 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
parent88a73106e8113a4a6ce224f9205e11219939798e (diff)
downloadTango-2ab54573d10ca59351100ab8416178be2223fc91.tar.gz
Tango-2ab54573d10ca59351100ab8416178be2223fc91.zip
Added support for caching on machine studio.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
index d4598867c..2e2b1a014 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs
@@ -84,6 +84,26 @@ namespace Tango.MachineStudio.UI
exceptionTrapper = new WpfGlobalExceptionTrapper();
exceptionTrapper.Initialize(this);
exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed;
+
+ //Apply Caching
+ if (settings.CachingMode != ObservablesContextInMemoryCachingMode.None)
+ {
+ LogManager.Log("EF Caching is enabled.");
+ LogManager.Log($"EF Caching mode is: {settings.CachingMode}.");
+ LogManager.Log($"EF Caching timeout: {settings.MaximumCacheTime.ToString()}");
+ try
+ {
+ ObservablesContext.EnableInMemoryCache(settings.MaximumCacheTime, settings.CachingMode);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error while trying to activate EF caching.");
+ }
+ }
+ else
+ {
+ LogManager.Log("EF Caching is disabled");
+ }
}
#region Global Exception Trapping