I am creating range of student entities in a raw but having problem while assigning sequential order id. I am trying to assign next order number, but all students get same order id.
newClass.Studends.AddRange(
newStudents.Select(student=> new Student
{
name=student.name,
orderid= student.AssociatedStudents.Max(as=>as.OrderId) + 1
})
);
P.S. The code above is not original code, I tried to create similar code.
Try
+ i++instead of just+1. I mean