I created an application that saves the state of a table (t) in XML everytime the user presses a button.
Conceptually, I do this with:
INSERT INTO Log (xml) VALUES ((SELECT * FROM t FOR XML AUTO));
The specs of the tables are similar to:
CREATE TABLE Log (xml XML NULL);
and:
CREATE TABLE t (i INTEGER, s NVARCHAR(MAX), d DATETIME);
The generated XML is like:
<t i="449" s="a string 1" d="2021-10-08T00:00:00" />
<t i="450" s="a string 2" d="2021-10-08T00:00:00" />
<t i="451" s="a string 3" d="2021-10-06T00:00:00" />
with no root.
Now, I have read the XML from the database back to C# as a string.
How may I convert this XML to my model:
public class tModel {
public long i;
public string s;
public DateTime d;
}