Reputation: 2976
I started using RavenDB and I am getting concurrency exceptions when I am creating an entity and linking the entity to another entity, for examples:
When creating a new student I am fetching the related class and adding the student to the "students" list. I saw that this storing and adding this relation is my bottleneck in my application.
How I can fix this concurrency problem? or maybe I can do this linking in other way? or update the Class with PatchRequest and then I won't have problems with concurrency?
Upvotes: 0
Views: 181
Reputation: 241890
You have two options
Really, you have a many-to-many relationship between students and classes - so you can store the related key on either side of the relationship (or both sides if desired).
If your app works more frequently with classes than students, try putting a list of ClassIds on each student. You can still get back a list of all students in the class via a query.
Aside - I suggest "Course" instead of "Class" to avoid stepping on keywords in c#
Upvotes: 2