コード例 #1
0
        private static void BulkDelete(EntitiesModel context)
        {
            // avoid showing the INSERT statements that populate the data
            context.Log = null;

            for (int i = 0; i < 10; i++)
            {
                Car car = new Car() { Make = "BMW", Model = "1020", CarYear = 2018, Available = true, CategoryID = 1, TagNumber = i.ToString()};
                context.Add(car);
            }
            context.SaveChanges();

            // show the delete statements
            context.Log = Console.Out;

            var query = context.GetAll<Car>().Where(c => c.CarYear > DateTime.Now.Year);
            int deleted = query.DeleteAll();
            Console.WriteLine("Deleted cars: {0}", deleted);
        }
コード例 #2
0
 private static string SomeMethod(Car car)
 {
     return string.Empty;
 }