Esempio n. 1
0
 public static void SaveCars(int carCount)
 {
     for (int i = 0; i < carCount; i++)
     {
         var carEntity = new Car()
         {
             Make = "StillVolkswagen",
             Model = "AlwaysBora",
             Year = i / 1000
         };
         session.Save(carEntity);
     }
     session.Flush();
 }
Esempio n. 2
0
        private static Car CreateNewCar(Random random, IList<Manufacturer> manus, int current)
        {
            int manufacturerNumber = random.Next(10);
            int PartsCount = random.Next(50);

            var carEntity = new Car()
            {
                Make = "StillVolkswagen",
                Model = "AlwaysBora",
                Year = current / 1000,
                Parts = new List<Part>()
            };

            for (int j = 0; j < PartsCount; j++)
            {
                carEntity.Parts.Add(new Part { Car = carEntity, Manufacturer = manus[manufacturerNumber], PartName = string.Format("PartType{0}", j) });
            }

            return carEntity;
        }