/// <summary> /// Crete random user and add it to DB /// </summary> /// <param name="countOfUsers" - the number of users to create></param> /// <param name="options" - server DB options></param> static void CreateUsersAndAddItToDB(int countOfUsers, DbContextOptions <ApplicationContext> options) { using (ApplicationContext db = new ApplicationContext(options)) { for (int i = 0; i < countOfUsers; ++i) { db.Users.Add(UserGenerator.CreateNewUser(new User())); } db.SaveChanges(); Console.WriteLine("Create users and add it to db"); } }