繁体   English   中英

C#数据源到内存,内存到XML文件

[英]c# datasource to memory and memory to xml file

我有要求

  1. 将数据库查询中的数据源保存到内存中,以便我可以遍历并更新内存中的某些项目。
  2. 我还需要能够将内存中的项目(根据上述项目1的结果)保存到硬盘驱动器上的xml文件中。
  3. 最后,我需要能够将xml文件加载到内存中。

谁能指出我这样做的最简单方法。 这些都是在Windows服务中完成的。

FAItemsUnderControl fItemsUnderControl = new FAItemsUnderControl(ConfigurationManager.AppSettings["DatabaseConnectionString"]);

//Note the line below is for binding to a gridview which is incorrect in my requirement but illustrates the idea

GridViewItemsUnderControlReport.DataSource = fItemsUnderControl.getItemsUnderControl("systemidtbd", "ALL");

我必须在服务端声明相同的对象列表

// Get items to Control into running memory
                FAItemsUnderControl fItemsUnderControl = new FAItemsUnderControl(ConfigurationManager.AppSettings["DatabaseConnectionString"]);
                MyGlobals.ListOfItemsToControl = fItemsUnderControl.getItemsUnderControl(MyGlobals.System_ID, "ALL").ToList<Usp_GetListItemsBySystemResult>();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM