サーバーディレクトリにxmlファイルを作成するコードがあります。このコードは、ユーザーが同じ時間にこのコードを処理するまで魅力的に機能します。ミリ秒速いユーザーはファイルの生成に成功し、他のユーザーはファイルを失います。みんな助けてください。
public static void XmlOrder(arg_order mod, string NewAddress)
{
XmlDocument XDoc = new XmlDocument();
XmlDeclaration xde = XDoc.CreateXmlDeclaration("1.0", "", "");
XDoc.AppendChild(xde);
XmlElement XElemRoot = XDoc.CreateElement("Digital_Order");
XElemRoot.SetAttribute("xmlns", "");
XDoc.AppendChild(XElemRoot);
foreach (arg_order modDetail in mod.arg_orders) {
XmlElement Xsource = XDoc.CreateElement("Document");
XElemRoot.AppendChild(Xsource);
XmlElement XTemp = XDoc.CreateElement("wt_web_Id");
XTemp.InnerText = modDetail.order_detail_id.ToString();
Xsource.AppendChild(XTemp);
XTemp = XDoc.CreateElement("wt_addr");
XTemp.InnerText = modCompany.qad_no;
Xsource.AppendChild(XTemp);
}
//naming and path
string name = arg_order_detail.FindAll().Count.ToString() + ".xml";
string path = ArgenXmlOrderPath + "/" + name;
XDoc.Save(path);
}