Ask first. Build objects only when you need them.
Memory2 separates answering a question from constructing application models. Queries can inspect millions of stored values without creating every object they examine. Hydration turns only the selected matches into complete C# object graphs.
Query
Filter, count, rank, join, group, or project directly from Memory2. The engine creates only the final answer requested by the query.
Build the selected objects
After narrowing the results, hydrate the matches into complete C# models, including their stored owned descendants.
// The filter runs inside Memory2. Fleet[] fleets = db.From<Fleet>() .Where(x => x.Name.StartsWith("fleet-east")) .Take(10) .Hydrate(); // Each result is now a complete stored C# object graph. Console.WriteLine(fleets[0].Vehicles[0].Tires.Count);
Need an answer?
Stay in LINQ. Return a scalar, projection, count, ranked window, group, or final result without constructing complete models.
Need complete matching models?
Call Hydrate() after filtering. Memory2 builds only the selected object graphs.
Know the identity already?
Use a direct read such as GetRequired to retrieve the complete stored object graph.
Need one inner object?
Query that type directly and save it directly. Hydrating its owner is optional.