My web site writes to XML files.
This is an example of the write to: a task xml .
/// <summary>
/// The name of the xml file containing the tasks data.
/// </summary>
private string tasksFile;
/// <summary>
/// The Xml Document that stores the contents of the tasks
/// xml file in memory once loaded.
/// </summary>
private XDocument tasksXml;
........
/// <summary>
/// Writes the xml task file to the disk
/// </summary>
private void SaveTask()
{
this.tasksXml.Save(this.tasksFile);
}
<代码>tasXml
由于不止一名用户可以同时试图在档案中书写,因此用户A可能会超越用户B所做的改动。
Edit: Trying to avoid User A opens, user B opens, both edit, then both save their changes (so only one wins)
A. How do I ensure that multiple users do not overwrite each other s work?
B. Would the term singleton be correct - if so how is it implemented?