I have a server side developed in c# with entity framework as a provider for SQL server. My server is managing a many to many relation between students and classes.
public class Student
{
public List<Course> Courses
.
.
}
public class Course
{
public List<Student> Students
.
.
}
My client side is developed in angular js with Typscript. To be synchronized with the server, each change in server is pushed to the clients with push notifications (signalr).
For faster response time, my client keeps a sort of database in memory (since the amount of data is not that big, less than 500 records). I keep an array of students and for each one of them also keep array of courses:
Students: { [studentId: number] : Courses } ={}
And in that object I keep track of all the students and their courses in the client side.
In my application I have the option to remove multiple courses from the entire system. However when doing such thing, when the action is successfully finished on server-side, the processing in the client side becomes heavy when there are many students. That is because I need to iterate through all the removed courses and for each one of them iterate through the entire students array to locate and remove those courses from the students array. (Or iterate the removed courses first and within iterate through the students) - both are heavy and take a while.
Is there a different better design for this? Should I approach this in a different way maybe?
in-built identifieras yourclassname