From 2ab54573d10ca59351100ab8416178be2223fc91 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 27 Feb 2019 16:49:42 +0200 Subject: Added support for caching on machine studio. --- .../MachineStudio/Tango.MachineStudio.UI/App.xaml.cs | 20 ++++++++++++++++++++ .../Tango.MachineStudio.UI/Views/AboutView.xaml | 7 +++++++ 2 files changed, 27 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') 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 diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml index 640c3c1df..54a8349e6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml @@ -6,6 +6,7 @@ xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:bl="clr-namespace:Tango.BL;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="700" Background="White" d:DataContext="{d:DesignInstance Type=vm:AboutViewVM, IsDesignTimeCreatable=False}" DataContext="{Binding AboutViewVM, Source={StaticResource Locator}}"> @@ -13,6 +14,7 @@ + @@ -60,6 +62,11 @@ () + Caching Mode: + + + (Requires restart) + -- cgit v1.3.1