C# 如何从读取XML的数据集更新实体框架?
我想通过WCF数据服务和实体框架更新我的数据库 从从磁盘读取的XML文件。 我正在使用数据集读取XML文件,但我不知道如何通过实体框架部分从数据集更新数据库。 我使用数据集来读取XML,因为它工作得很好,但是如果有 是另一种通过实体框架将XML读入数据库的方法,这将非常好。 我想要的代码如下所示C# 如何从读取XML的数据集更新实体框架?,c#,xml,wcf,entity-framework,C#,Xml,Wcf,Entity Framework,我想通过WCF数据服务和实体框架更新我的数据库 从从磁盘读取的XML文件。 我正在使用数据集读取XML文件,但我不知道如何通过实体框架部分从数据集更新数据库。 我使用数据集来读取XML,因为它工作得很好,但是如果有 是另一种通过实体框架将XML读入数据库的方法,这将非常好。 我想要的代码如下所示 private void AddToDBFromXMLFile(string xmlFile) { // this is reading my XML just fine, but i susp
private void AddToDBFromXMLFile(string xmlFile)
{
// this is reading my XML just fine, but i suspect there is another way to
// get the XML into the
// database, otherwise how can I get the XML into the database via the EF?
DataSet dataSet = new DataSet();
dataSet.ReadXml(xmlFile, XmlReadMode.InferSchema);
// this is working and can update and retrieve my data using the usual methods
var proxy = new TestApp.ServiceReference.TestEntities(new
Uri("http://localhost:4976/TestWcfDataService.svc/"));
// how do I update the database from the dataset?
//proxy << dataset
}