Example #1
0
 private static void InsertMultipleSamurais()
 {
     //Bulk insert happens at 4 inserts
     var bizdata            = new BusinessDataLogic();
     var samuraiNames       = new string[] { "Sampson", "Tasha", "Number3", "Number4" };
     var newSamuraisCreated = bizdata.AddMultipleSamurais(samuraiNames);
 }
 private static void InsertMultipleSamurais()
 {
     //var samurai = new Samurai { Name = "Sampson" };
     //var samurai2 = new Samurai { Name = "Tasha" };
     //var samurai3 = new Samurai { Name = "Number3" };
     //var samurai4 = new Samurai { Name = "Number4" };
     var _bizdata           = new BusinessDataLogic();
     var samuraiNames       = new string[] { "Sampson", "Tasha", "Number3", "Number4" };
     var newSamuraisCreated = _bizdata.AddMultipleSamurais(samuraiNames);
 }
Example #3
0
        private static void InsertMultipleSamuraisTest()
        {
            //var samurai1 = new Samurai { Name = "Georgette" };
            //var samurai2 = new Samurai { Name = "Claudia" };
            //var samurai3 = new Samurai { Name = "Janice" };
            //var samurai4 = new Samurai { Name = "Penelope" };

            var bizData           = new BusinessDataLogic();
            var samuraiNames      = new String[] { "Georgette", "Claudia", "Janice", "Penelope" };
            var newSamuraiCreated = bizData.AddMultipleSamurais(samuraiNames);
        }
Example #4
0
        private static void InsertMultipleSamurais()
        {
            //DbSet AddRange() method
            //var samurai = new Samurai { Name = "Samurai-1" };
            //var samurai2 = new Samurai { Name = "Samurai-2" };
            //var samurai3 = new Samurai { Name = "Samurai-3" };
            //var samurai4 = new Samurai { Name = "Samurai-4" };
            //Add to context.Samurais DbSet, so it's an in-memory collection of samurais that the context keeps track of
            //_context.AddRange(samurai, samurai2, samurai3, samurai4);
            //Save the data that the context is tracking back to the db
            //_context.SaveChanges();

            var _bizdata           = new BusinessDataLogic();
            var samuraiNames       = new string[] { "Samson", "Tasha", "Number3", "Number4" };
            var newSamuraisCreated = _bizdata.AddMultipleSamurais(samuraiNames);
        }
Example #5
0
        private static void AddMultipleSamurais()
        {
            var busLogic = new BusinessDataLogic();

            string[] names = { "Fred", "Grizelda", "Cindy", "Ollie", "Draco", "Harry" };
            var      count = busLogic.AddSamurais(names);

            Console.WriteLine($"Samurais added: {count}");
            //var samurais = new List<Samurai>();
            //samurais.Add(new Samurai() { Name = "Fred" });
            //samurais.Add( new Samurai() { Name = "Grizelda" });
            //samurais.Add(new Samurai() { Name = "Cindy" });
            //samurais.Add( new Samurai() { Name = "Ollie" });
            //samurais.Add(new Samurai() { Name = "Draco" });
            //samurais.Add( new Samurai() { Name = "Harry" });
            //context.Samurais.AddRange(samurais);
            //context.SaveChanges();
        }
 private static void InsertSamurais()
 {
     var businessDataLogic  = new BusinessDataLogic(_context);
     var newSamuraisCreated = businessDataLogic.AddMultipleSamurais(
         new string[] { "Sampson", "Tasha", "Other samurai 1", "Other samurai 2" });
 }