When the TopicMappingService converts a topic entity into a view model, the lazy-loading implementation fetches any necessary data piecemeal: One small database round-trip per property, discovered only as each property is mapped. This fixes that by analyzing each view model type once, up front, to determine exactly what data it needs, then fetches all of it in a single consolidated request at the start of the conversion instead of triggering multiple requests as it goes. It then caches that payload so it doesn't need to analyze the same view model every request.
Tasks
When the
TopicMappingServiceconverts a topic entity into a view model, the lazy-loading implementation fetches any necessary data piecemeal: One small database round-trip per property, discovered only as each property is mapped. This fixes that by analyzing each view model type once, up front, to determine exactly what data it needs, then fetches all of it in a single consolidated request at the start of the conversion instead of triggering multiple requests as it goes. It then caches that payload so it doesn't need to analyze the same view model every request.Tasks
Topic.EnsureLoaded()); see Mapping Services Lazy-Loading Integration #118[RequiresPayload]attribute so a view model can declare its data needs explicitly, bypassing analysis (new type inOnTopic.Mapping.Annotations)MappingPayloadProfile)EnsureLoaded()request at the top of eachMapAsync()conversion, before property mapping (TopicMappingService)NavigationTopicViewModelinOnTopic.ViewModels)LazyLoadingTopicRepository.ResolveDeferredAssociations()); see Batch loadDeferredassociations #127TopicMappingService.FlattenTopicGraph,PopulateTargetCollectionAsync()Topic.EnsureLoaded(),ITopicLoadResolver.EnsureLoaded()