Skip to content

Commit 715a6cf

Browse files
committed
Merge pull request #17 from tuespetre/master
Serialize dictionary to XML without including double quotes; simplify…
2 parents c280692 + ed00643 commit 715a6cf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Serilog.Sinks.MSSqlServer/Sinks/MSSqlServer/XmlPropertyFormatter.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static string Simplify(LogEventPropertyValue value, ColumnOptions.Propert
6565
}
6666
}
6767

68-
var key = SimplifyScalar(element.Key);
68+
var key = SimplifyScalar(element.Key.Value);
6969
if (options.UsePropertyKeyAsElementName)
7070
{
7171
sb.AppendFormat("<{0}>{1}</{0}>", GetValidElementName(key), itemValue);
@@ -204,10 +204,7 @@ static string SimplifyScalar(object value)
204204
{
205205
if (value == null) return null;
206206

207-
const string dummyTag = "toEscape";
208-
var toEscape = new XElement(dummyTag, value.ToString());
209-
var asElement = toEscape.ToString();
210-
return asElement.Substring(dummyTag.Length + 2, asElement.Length - (dummyTag.Length*2 + 5));
207+
return new XText(value.ToString()).ToString();
211208
}
212209
}
213210
}

0 commit comments

Comments
 (0)