mikependon / RepoDB

A hybrid ORM library for .NET.
Apache License 2.0
1.7k stars 125 forks source link

QueryGroup optimization #1115

Closed SergerGood closed 1 year ago

SergerGood commented 1 year ago

The GetFields method is called multiple times during the lifetime of the QueryGroup. During the method call occur calculations. I saved the value of the calculation in a variable traversedQueryFields. Also I changed the variable type of QueryFields and QueryGroups with IReadOnlyList, because variables are converted to a list in the constructor. https://github.com/mikependon/RepoDB/blob/faa9d24a4889b6bdd397e99b138d9536d5c5011b/RepoDb/RepoDb/QueryGroup.cs#L236

This allows not to cast once again and use the Count property immediately.

before: изображение

after: изображение