public static void PersonGen(int Len, int ramControler) { len = Len; RamControler = ramControler; Modals.Persons.Person[] Pr = new Modals.Persons.Person[RamControler]; for (int i = 0; i < len; i++) { for (int j = 0; j < RamControler; j++) { Pr[j] = new Modals.Persons.Person { FullName = RandomGen.GetFulNameDefault(), Password = RandomGen.GetPasswordDefault(8), AccessLevel = 1 }; } for (int j = 0; j < RamControler; j++) { try { ConectionToDb.AddNewPeronNoLimited(Pr, RamControler); } catch (Exception ex) { throw ex; } } } }
public static void PersonGene(int count) { Modals.Persons.Person Pr = new Modals.Persons.Person(); using (var db = new Modals.Context()) { for (int i = 0; i < count; i++) { Pr = new Modals.Persons.Person { FullName = RandomGen.GetFulNameDefault(), Password = RandomGen.GetPasswordDefault(8), AccessLevel = 1 }; db.Persons.Add(Pr); } db.SaveChanges(); } }