diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs index 91aa049e9..f3ae1002b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs @@ -78,21 +78,28 @@ namespace Tango.MachineStudio.Common.EventLogging { if (!_isInitialized) { - _db = ObservablesContext.CreateDefault(); - _db.Configuration.LazyLoadingEnabled = false; + try + { + _db = ObservablesContext.CreateDefault(); + _db.Configuration.LazyLoadingEnabled = false; - _db.ActionTypes.ToList(); - _db.EventTypesActions.ToList(); - _db.EventTypesCategories.ToList(); - _db.EventTypesGroups.ToList(); - _db.EventTypes.ToList(); + _db.ActionTypes.ToList(); + _db.EventTypesActions.ToList(); + _db.EventTypesCategories.ToList(); + _db.EventTypesGroups.ToList(); + _db.EventTypes.ToList(); - foreach (var type in _db.EventTypes) + foreach (var type in _db.EventTypes) + { + _eventTypesGuids.Add((EventTypes)type.Code, type); + } + + _isInitialized = true; + } + catch { - _eventTypesGuids.Add((EventTypes)type.Code, type); + _isInitialized = false; } - - _isInitialized = true; } } |
