Skip to content

Commit

Permalink
Fixes #2724
Browse files Browse the repository at this point in the history
  • Loading branch information
jwyza-pi committed Dec 13, 2024
1 parent 2406c89 commit 36d0855
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Core/RevEng.Core.80/ReverseEngineerRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,26 @@ private static List<string> MoveConfigurationFiles(IList<string> files)
var movedFiles = new List<string>();
foreach (var configurationFile in configurationFiles)
{
// This handles the scenario where an Entity ends with the word "Configuration" such as "SoftwareConfiguration". In this scenario
// there would be 2 files "SoftwareConfiguration.cs" and "SoftwareConfigurationConfiguration.cs". The former is the entity model itself
// which should not be moved. We're also checking to make sure the line isn't part of a comment block. (to handle a scenario where someone
// has customized the EntityType.t4 to include a comment block that points to the EntityTypeConfiguration file)
bool isConfigFile = false;
foreach (var line in File.ReadLines(configurationFile))
{
if (line.Contains("EntityTypeConfiguration<", StringComparison.Ordinal)
&& !(line.Trim().StartsWith('/') || line.Trim().StartsWith('*')))
{
isConfigFile = true;
break;
}
}

if (!isConfigFile)
{
continue;
}

var newDirectoryName = Path.Combine(Path.GetDirectoryName(configurationFile) ?? string.Empty, "Configurations");
if (newDirectoryName is null)
{
Expand Down

0 comments on commit 36d0855

Please sign in to comment.