Tip 47 – How fix-up can make it hard to change relationships Problem: Take this code: Category oldCategory = ctx.Categories .Include("Products") .First(c => c.Name == "Drink");
Category newCategory = new Category {Name = "Beverage"};
foreach(Product product in oldCategory.Products) { newCategory.Products.Add(product); } Ignore for a second that in this example the solution is probably just to rename the oldCategory "Beverages" - Coming up with real world samples gets hard...
No comments yet, be the first one to post comment.