Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从读取XML的数据集更新实体框架?_C#_Xml_Wcf_Entity Framework - Fatal编程技术网

C# 如何从读取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

我想通过WCF数据服务和实体框架更新我的数据库 从从磁盘读取的XML文件。 我正在使用数据集读取XML文件,但我不知道如何通过实体框架部分从数据集更新数据库。 我使用数据集来读取XML,因为它工作得很好,但是如果有 是另一种通过实体框架将XML读入数据库的方法,这将非常好。 我想要的代码如下所示

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 
}