Skip to content

Commit

Permalink
Fix bug where application still has open connections to SQLite3 db. F…
Browse files Browse the repository at this point in the history
…ix bug found in manage copybook view.
  • Loading branch information
Connor Moreside committed Feb 5, 2017
1 parent bb54bec commit 1ec3cba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CodeMovement.EbcdicCompare.App/App.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Application x:Class="CodeMovement.EbcdicCompare.App.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CodeMovement.EbcdicCompare.App">
xmlns:local="clr-namespace:CodeMovement.EbcdicCompare.App"
Exit="Application_Exit">
<Application.Resources>
<Style x:Key="LinkButton" TargetType="Button" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
<Setter Property="Width" Value="Auto"/>
Expand Down
14 changes: 7 additions & 7 deletions CodeMovement.EbcdicCompare.App/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows;

namespace CodeMovement.EbcdicCompare.App
{
Expand All @@ -18,5 +12,11 @@ protected override void OnStartup(StartupEventArgs e)
var bootstrapper = new Bootstrapper();
bootstrapper.Run();
}

private void Application_Exit(object sender, ExitEventArgs e)
{
// Ensure that all SQLiteConnections are closed.
System.Data.SQLite.SQLiteConnection.ClearAllPools();
}
}
}
5 changes: 3 additions & 2 deletions CodeMovement.EbcdicCompare.Services/FileOperationsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ public OperationResult<string> CopyFile(string fromPath, string toPath)
try
{
var fileName = Path.GetFileName(fromPath);
var newToPath = Path.Combine(toPath, fileName);
var newToPath = Path.GetFullPath(Path.Combine(toPath, fileName));

_fileOperation.Copy(fromPath, newToPath, true);
if (fromPath != newToPath)
_fileOperation.Copy(fromPath, newToPath, true);

result.Result = newToPath;
}
Expand Down

0 comments on commit 1ec3cba

Please sign in to comment.