houssam.hamdan wrote:Thanks Vipal for your reply.
1- I believe the lazy loading is not well described by microsoft. By its definition, i agree with you that when disabled all related entities are filled when you load a specific entity but in practice its not the case. If you request to get data from single entity with no join query, related entities are not filled up. Related entities are filled up only when you use the .Include() in your query. Therefore, disabling lazy loading is a performance improvement on EF queries and not a bad thing.
2- Why in nop, we are disabling autotracking only when calling stored procedures ? Why not doing the same for dbContext Insert() operation ?
Thanks in advance for your clarification.
I agree with your point #1 its little bit confusing.
for point #2 we can disable the autotracking only when we are retriving the data only for readonly operation.
i mean after fetching the entities we are not going to update or delete the entities.
and we did it on storage procedure as we are calling SP for get all product for read only purposes.
and when we retrieve the data from SP those entities is not attached with DB context.
so before attaching those entities to DB context they have disabled the tracking for performance improvement as we are fetching products only for listing purpose either on front end or on back end
so we can not disable autotracking on insert time as that time tracking should be enabled to know EF that Entity is inserted or modified or deleted etc.