Repository navigation
JasperFx 2.84.0
Dynamic LINQ (#869, #999)
JasperFx.Linq.DynamicQuerycomposes a predicate and an ordering written as text onto anIQueryablewhose element type is known only at runtime, so the store's own LINQ provider does the translation. Built onSystem.Linq.Dynamic.Core1.7.4. Docs: LINQ → Dynamic LINQ Queries.- Locked down twice: a parser with no custom types, no
newand no type lookup by name, then a post-parse allow-list (a short list of string and collection methods that must touch the document; no static members, conditionals, or construction beyond dates, times and Guids) and caps on text length, arguments and tree size. - Works on providers that only implement the generic
CreateQuery<T>(Marten's non-generic one throws). - Date text is read as UTC, numbers with the invariant culture;
JsonElementarguments — whatobject?[]becomes after a JSON wire — are unwrapped. DynamicQueryExceptioncarries the clause, the reason and the parser's position.
- Locked down twice: a parser with no custom types, no
- Store shape rules:
DynamicQueryPolicy.ShapeRulesandDynamicQueryShapeRuleslet a store refuse shapes its provider would translate into the wrong rows.SqlNullSemantics()refuses an unguarded<>(or a negated comparison) on a nullable member: SQL's three-valued logic silently drops every null row, measured on Marten, Polecat and Fisher alike. - Document diagnostics criteria:
DocumentQueryOptions.ApplyCriteriaTo/Untranslatable/IsTranslationFailureapplyWhere/OrderBy/Argumentsand turn every failure intoDocumentCriteriaNotSupportedException, which gainsPosition. Refused under Native AOT. - The in-memory store applies criteria with LINQ to objects, and
DocumentStoreDiagnosticsCompliancegains twelve criteria facts.ComplianceDocuments.csnow declares#nullable enable, because it compiles inside the consumer. stream-query --where / --order-byoverStreamState.- AOT: the new entry points are annotated
[RequiresDynamicCode]/[RequiresUnreferencedCode]; the AOT smoke project stays green.
JasperFx consumer now picks up System.Linq.Dynamic.Core transitively (no dependencies of its own on net8+).
Also since 2.82.0 (shipped in 2.83.0)
DcbModel<T>()as a synonym forDeciderModel<T>()on the event model slice builder.- View projection hints on the event model:
AsSingleStream()/AsMultiStream()/AsDcbModel(). EventTagQuery.For(tag)selects events with that tag. Before,For(a)alone had no condition andFor(a).Or(b)quietly queriedbalone;For(...).AndEventsOfType<...>()queries are unchanged.
Wire additions
DocumentCriteriaNotSupportedException.Position(init-only).- New interface
JasperFx.Linq.IDynamicQueryShapeRule. EventModelRole.ViewProjection(2.83.0), appended so existing integer values don't change.