public GenerateItems(int countItems, GenerateDbContext db) { _faker = new Faker("ru"); _count = countItems; _db = db; _listEntity = new List <IEntity>(); }
public bool GenerateDbContext() { try { GenerateDbContext _GenerateDbContext = new GenerateDbContext(); } catch (Exception ex) { throw ex; } return(true); }
static void Main(string[] args) { try { using (var context = new GenerateDbContext()) { Console.WriteLine("Auto Generator"); while (true) { UiProcess.CleareImportedCount(); var creator = UiProcess.SelectCreator(); var count = UiProcess.SetCountItems(); GenerateItems generateItems = new GenerateItems(count, context); generateItems.Notify += UiProcess.ProgressImport; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); generateItems.RunGenerator(creator); stopwatch.Stop(); UiProcess.GetResultMessage(stopwatch); if (!UiProcess.GoOn()) { return; } } } } catch (Exception ex) { UiProcess.GetErrorMessage(ex.Message); } Console.ReadKey(); }
public void Execute() { using (var generateDbContext = new GenerateDbContext()) { generateDbContext.Database.EnsureCreated(); var project = new Project(); project.AddMember(new Member { Id = "100", Name = "1000" }); project.SetId("100"); generateDbContext.Set <Project>().Add( project); generateDbContext.SaveChanges(); } using (var generateDbContext = new GenerateDbContext()) { var project = generateDbContext.Set <Project>().Single(e => e.Id == "100"); Assert.NotNull(project); } }
public void Setup() { using (var context = new GenerateDbContext()) { generateItems = new GenerateItems(Count, context); } }