Skip to content

LinqExtensionMethods

Craig Fowler edited this page Feb 22, 2020 · 2 revisions

The library also includes a number of extension methods designed for use by Linq-based queries, for features such as:

  • Lazy-resolution of query results, enabling the underlying ORM to batch multiple queries together.
  • Eager-fetching of objects related to the query, to retrieve 'child' & 'grandchild' entities at the same time as retrieving their parents
  • Asynchronous querying, to improve performance by performing I/O-bound operations asynchronously

With regard to these three areas, the entry-point to this functionality is provided via a an extension methods class in the CSF.ORM namespace: QueryableExtensions. However, the functionality is not entirely static; the implementation which backs these operations may be swapped via the properties on the extension methods class.

  • EagerFetchingProvider: an implementation of IEagerlyFetchesFromQuery
  • LazyQueryingProvider: an implementation of IGetsLazyQueryResult
  • AsyncQueryingProvider: an implementation of IProvidesAsyncQuerying

Because these properties are static, they are not thread-safe. They should be set only during application (or test) start-up.

Clone this wiki locally