static void Main(string[] args) { using(var db = new DataContext("DBShop")) { db.Configuration.ValidateOnSaveEnabled = false; using(var reader = new DataReader(@"..\..\Data\div_tech.xml")) { var dataMover = new DataMover(db); dataMover.LoadData(reader); } } }
public void LoadData(DataReader reader) { try { LoadCurrencies(reader.GetXmlItems("currency")); LoadCategories(reader.GetXmlItems("category")); LoadProducts(reader.GetXmlItems("offer")); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } }