Is it possible to work with Entity Framework (Code First) and having the data source being an XML file? I need to populate the domain objects with values from the XML file.
The XML file has this structure:
<Person name="John" age="12">
<Products>
<Product id="1" name="Product 1" />
<Product id="2" name="Product 2" />
<Product id="3" name="Product 3" />
</Products>
</Person>
C# domain objects has this structure:
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
public ICollection<Product> Products { get; set; }
}
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
}
I can use Linq to XML to parse trough each element of XML and populate the objects, but i was looking for a more automated way to do this (if exists).