私は2つのクラスを持っています
class WarningClass
{
public string SqlEyeWarning { get; set; }
public string FileName { get; set; }
}
class RemarkClass
{
public string SqlEyeRamark { get; set; }
public string FileName { get; set; }
}
それらは以下のように入力されます
List<WarningClass> lstWarningClass = new List<WarningClass>();
lstWarningClass.Add(new WarningClass { FileName = "a.sql", SqlEyeWarning = "SD001: Set QuotedIdentifier ON statement is missing" });
lstWarningClass.Add(new WarningClass { FileName = "b.sql", SqlEyeWarning = "SD001: Set QuotedIdentifier ON statement is missing" });
lstWarningClass.Add(new WarningClass { FileName = "c.sql", SqlEyeWarning = "SD009: Missing or order mismatch of Grant statement" });
lstWarningClass.Add(new WarningClass { FileName = "a.sql", SqlEyeWarning = "SD009: Missing or order mismatch of Grant statement" });
lstWarningClass.Add(new WarningClass { FileName = "d.sql", SqlEyeWarning = "SD004: Check for existence object then Drop statement before create statement" });
List<RemarkClass> lstRemarkClass = new List<RemarkClass>();
lstRemarkClass.Add(new RemarkClass { FileName = "a.sql", SqlEyeRamark = "SD010: Set AnsiiNullsOn ON statement is missing" });
lstRemarkClass.Add(new RemarkClass { FileName = "b.sql", SqlEyeRamark = "SD002: Order mismatch or it should be ON." });
lstRemarkClass.Add(new RemarkClass { FileName = "c.sql", SqlEyeRamark = "SD002: Order mismatch or it should be ON." });
望ましい出力は
<ScriptFileNames>
<SqlEye>
<SqlEyeWarnings Name="Set QuotedIdentifier ON statement is missing">
<File Name="a.sql" />
<File Name="b.sql" />
</SqlEyeWarnings>
<SqlEyeWarnings Name="SD009: Missing or order mismatch of Grant statement">
<File Name="a.sql" />
<File Name="c.sql" />
</SqlEyeWarnings>
<SqlEyeWarnings Name="SD004: Check for existence object then Drop statement before create statement">
<File Name="d.sql" />
</SqlEyeWarnings>
<SqlEyeRemarks Name="SD010: Set AnsiiNullsOn ON statement is missing">
<File Name="a.sql" />
</SqlEyeRemarks>
<SqlEyeRemarks Name="SD002: Order mismatch or it should be ON.">
<File Name="b.sql" />
<File Name="c.sql" />
</SqlEyeRemarks>
</SqlEye>
</ScriptFileNames>