private static void LoadRatings(CloudCompareContext context) { //using (var context = new CloudCompareContext()) { var data = new FakeData(); Random r = new Random(); data.InsertRatings(context, r); context.SaveChanges(); } }
private static void InsertVendor() { var vendor = new Vendor { VendorName = "XERO" }; using (var context = new CloudCompareContext()) { context.Vendors.Add(vendor); context.SaveChanges(); } }
private static void StageData() { var data = new FakeData(); //var context = new FakeCloudCompareContext(); var context = new CloudCompareContext(); data.LoadFakeReferenceData(context); try { context.SaveChanges(); } 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); } } } catch (DbUpdateException dbEx) { foreach (var validationErrors in dbEx.Entries) { //foreach (var validationError in validationErrors.ValidationErrors) { //Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } data.LoadFakeProductionData(context); try { context.SaveChanges(); } 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); } } } catch (DbUpdateException dbEx) { foreach (var validationErrors in dbEx.Entries) { //foreach (var validationError in validationErrors.ValidationErrors) { //Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } LoadRatings(context); try { context.SaveChanges(); } 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); } } } catch (DbUpdateException dbEx) { foreach (var validationErrors in dbEx.Entries) { //foreach (var validationError in validationErrors.ValidationErrors) { //Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } }