equinor / flotilla

Flotilla is the main point of access for operators to interact with multiple robots in a facility.
Eclipse Public License 2.0
16 stars 38 forks source link

Use entity framework read only in more places #1703

Closed andchiind closed 3 months ago

andchiind commented 3 months ago

By using readOnly capabilities more often we are able to be more precise with our database operations, preventing future bugs. This will also speed up the code somewhat as there are fewer checks performed when not tracking objects within an entity framework context.

We currently also manually set many object to have the entity state "detached" in the code to prevent them from being updated. I believe that by refraining from tracking these objects we may sometimes be able to avoid this "hacky" behaviour, but I am cautious about doing this in this PR. We should try to make a PR though where we investigate everywhere we use this entry state statement, and instead try to not track the object.