XmlDefineFileManage.cs 811 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.IO;
  3. using System.Xml;
  4. namespace WebAPIBase.NetCore.BusinessCore
  5. {
  6. public sealed class XmlDefineFileManage
  7. {
  8. private XmlDefineFileManage()
  9. {
  10. }
  11. public static XmlDocument GetXmlDoc(string fileName)
  12. {
  13. try
  14. {
  15. string text = ApplicationConfiguration.EntityDefinePath + fileName + ".xml";
  16. if (!File.Exists(text))
  17. {
  18. throw new ApplicationException(text + " 文件不存在");
  19. }
  20. XmlDocument xmlDocument = new XmlDocument();
  21. xmlDocument.Load(text);
  22. return xmlDocument;
  23. }
  24. catch (Exception ex)
  25. {
  26. throw ex;
  27. }
  28. }
  29. }
  30. }