1
0
mirror of synced 2024-11-27 23:50:49 +01:00

Workaround unclosed tag issue, update .gitignore

This commit is contained in:
Yuchen Ji 2022-04-05 03:01:11 +08:00
parent d9c717de6f
commit 001a410cc5
2 changed files with 10 additions and 7 deletions

View File

@ -435,3 +435,5 @@ MigrationBackup/
# Fody - auto-generated XML schema # Fody - auto-generated XML schema
FodyWeavers.xsd FodyWeavers.xsd
# Ignore card db since we should start from scratch
/db/card.db3

View File

@ -440,20 +440,21 @@ public class CardServiceController : WebApiController
{ {
var stringBuilder = new StringBuilder(); var stringBuilder = new StringBuilder();
for (var i = 0; i < list.Count; i++)
{
var obj = list[i];
obj.RecordId = i + 1;
}
using (var writer = new ChoXmlWriter<T>(stringBuilder)) using (var writer = new ChoXmlWriter<T>(stringBuilder))
{ {
writer.Configuration.OmitXmlDeclaration = false; writer.Configuration.OmitXmlDeclaration = false;
writer.Configuration.UseXmlSerialization = true; writer.Configuration.UseXmlSerialization = true;
writer.WithXPath(xpath); writer.WithXPath(xpath);
writer.Write(list);
for (var i = 0; i < list.Count; i++)
{
var obj = list[i];
obj.RecordId = i + 1;
writer.Write(obj);
}
} }
stringBuilder.Insert(stringBuilder.Length - 5, "/");
return stringBuilder.ToString(); return stringBuilder.ToString();
} }