a.m. wrote:I proposed many improvements, concerning change tracking, lazy loading for example, nobody answers on these points. The idea was not to kill EF but use it better, with official and documented options. And these options was created to use EF faster, I don't understand why we are waiting to integrate this.
It's a shame for me to have 50 or 100 database request to load a page, I can't explain to my customers why there store is so slow, it's not there problem, it's mine.
Hi Nicolas,
Thanks. I still have links to all your suggestions on my internal performance improvements list. All possible suggestions were implemented. But some of them are too complex to implement. For example, change tracking. There's just no good way to implement it. It'll require each service method to be extended with "bool disableChangeTracking" (or "readOnly"), etc.Maybe, I missed something. It would be great if you could demonstrate how exactly it could be implemented.
Hi Andrei!
You are right, we could add readOnly parameter to each GetSomething method, in last position with default value to false, so that it would not affect existing code for developers. Then a single line would disable change tracking like this example :
public virtual IPagedList<Category> GetAllCategories(string categoryName = "",
int pageIndex = 0, int pageSize = int.MaxValue, bool showHidden = false, bool readOnly = false)
{
var query = _categoryRepository.Table;
if (readOnly) query = query.AsNoTracking();
The second step is to set this new parameter to true for homepage, categories and products in priority, then have a reflexion on settings, locales, etc.