Skip to content

Commit c0992bd

Browse files
committed
Move FileAuditService creation to ctor.
1 parent 8e59f21 commit c0992bd

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

EntityFramework.Reverse.POCO.Generator/EF.Reverse.POCO.v3.ttinclude

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,7 @@
17501750
private readonly Dictionary<string, IFileManager> _fileManagers;
17511751
private IFileManager _fileManager;
17521752
private VisualStudioFileManager _visualStudioFileManager;
1753-
private FileAuditService _auditService;
1753+
private readonly FileAuditService _auditService;
17541754
private bool _writeToOuter;
17551755
public bool ForceWriteToOuter;
17561756

@@ -1762,7 +1762,7 @@
17621762
_fileManagers = new Dictionary<string, IFileManager>();
17631763
_fileManager = null;
17641764
_visualStudioFileManager = null;
1765-
_auditService = null;
1765+
_auditService = new FileAuditService();
17661766
}
17671767

17681768
public static void DeleteFile(string filename)
@@ -1783,7 +1783,6 @@
17831783
Settings.FilterCount = filters.Count;
17841784

17851785
_writeToOuter = Settings.GenerateSingleDbContext && !Settings.GenerateSeparateFiles;
1786-
_auditService = new FileAuditService();
17871786

17881787
// For debug
17891788
/*var a = _writeToOuter;

Generator/FileManagement/FileManagementService.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class FileManagementService : IFileManager
1111
private readonly Dictionary<string, IFileManager> _fileManagers;
1212
private IFileManager _fileManager;
1313
private VisualStudioFileManager _visualStudioFileManager;
14-
private FileAuditService _auditService;
14+
private readonly FileAuditService _auditService;
1515
private bool _writeToOuter;
1616
public bool ForceWriteToOuter;
1717

@@ -23,7 +23,7 @@ public FileManagementService(GeneratedTextTransformation outer)
2323
_fileManagers = new Dictionary<string, IFileManager>();
2424
_fileManager = null;
2525
_visualStudioFileManager = null;
26-
_auditService = null;
26+
_auditService = new FileAuditService();
2727
}
2828

2929
public static void DeleteFile(string filename)
@@ -44,7 +44,6 @@ public void Init(Dictionary<string, IDbContextFilter> filters, Type fileManagerT
4444
Settings.FilterCount = filters.Count;
4545

4646
_writeToOuter = Settings.GenerateSingleDbContext && !Settings.GenerateSeparateFiles;
47-
_auditService = new FileAuditService();
4847

4948
// For debug
5049
/*var a = _writeToOuter;

0 commit comments

Comments
 (0)