XML : How to parse XML and insert into DB with Entity Framework

I am trrying to get an xml from HTTP address with the code below...

  var xml = XDocument.Load("http://www.tcmb.gov.tr/kurlar/201501/02012015.xml");    

when I run the code above, it gives me the following xml

  <?xml-stylesheet type="text/xsl" href="isokur.xsl"?>  <Tarih_Date Tarih="02.01.2015" Date="01/02/2015" Bulten_No="2015/1">    <Currency CrossOrder="0" Kod="USD" CurrencyCode="USD">      <Unit>1</Unit>      <Isim>ABD DOLARI</Isim>      <CurrencyName>US DOLLAR</CurrencyName>      <ForexBuying>2.3449</ForexBuying>      <ForexSelling>2.3491</ForexSelling>      <BanknoteBuying>2.3433</BanknoteBuying>      <BanknoteSelling>2.3526</BanknoteSelling>      <CrossRateUSD>1</CrossRateUSD>      <CrossRateOther></CrossRateOther>    </Currency>    <Currency CrossOrder="1" Kod="AUD" CurrencyCode="AUD">      <Unit>1</Unit>      <Isim>AVUSTRALYA DOLARI</Isim>      <CurrencyName>AUSTRALIAN DOLLAR</CurrencyName>      <ForexBuying>1.9023</ForexBuying>      <ForexSelling>1.9147</ForexSelling>      <BanknoteBuying>1.8935</BanknoteBuying>      <BanknoteSelling>1.9262</BanknoteSelling>      <CrossRateUSD>1.2298</CrossRateUSD>      <CrossRateOther></CrossRateOther>    </Currency>    ......    ......    ......    

Then, I would like to insert that xml into DB with EntityFramework but is there a easy way to do it?

Can anybody give me a clue?

No comments:

Post a Comment