Answer the question
In order to leave comments, you need to log in
How to save an object that contains a collection of other objects using Entity?
public class Position
{
}
Answer the question
In order to leave comments, you need to log in
public class Position
{
public string ConsumptionRateUnit { get; set; }
public List<Operation> Operations { get; set; }
}
public class Operation
{
public int? Id_position { get; set; }
public int? Id { get; set; }
public string FormValuation { get; set; }
}
var items = (from position in doc.Element("TechNorm").Elements("Position")
select new Position()
{
...
}
using (var db = new LoadNsiContext())
{
foreach (var operation in items)
{
db.Operations.Add(operation);
}
db.SaveChanges();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question