Using XmlDocument.Save() Effectively

debrakarachi

New Member
I'm working with a .XML document in C# to which I'm selecting nodes from, adding nodes to, and deleting nodes many, many times over a span of my code.All of the XML editing of this document is contained within a class, which other classes call to.Since the Data Access class has no way of telling if the classes using it are done with editing the document, it has no logic as to if/when to save.I could save after every modification of the document, but I'm concerned with performance issues.Alternatively I could just assume/hope that it will be saved by the other classes that use it (I created a one-line public method to save the document, so another class can request a save).The second option concerns me as I feel like I should have it globally enforced in some manner to avoid it being called upon and modifications not being committed. To this point there will never be a case where a rollback is needed; any change is a change that should be committed.Does .Net (Or coding design) have a way to balance performance and safety in such a situation?
 
Back
Top