I am storing developer notes in XML files within the project, to eliminate storing them on a SQL instance to reduce database calls.
I have my class set up to be Serialized
[Serializable]
public class NoteDto
{
[NonSerialized]
private string _project;
public string Date { get; set; }
public string Time { get; set; }
public string Author { get; set; }
public string NoteText { get; set; }
public string Project
{
get => _project;
set => _project = value;
}
}
to create this element
<Note>
<Date></Date>
<Time></Time>
<NoteText></NoteText>
<Author></Author>
</Note>
The reason I do not want Project property serialized, is that the Note Element is in a parent element (NotesFor).
<NotesFor id="project value here">
// note element here
</NotesFor>
I need the Project string to search for the Node where the NotesFor element id = Project then append the created element to the end of its children.
So that leaves two questions
- Do I create an XElement and append to current node or do I create a string to append to the node in the Xml file? I don't work much with Xml so I am not sure what the standard protocol is to update Xml files.
- Is there a better way to accomplish what I am trying to do?