What is the correct syntax for eager fetching with LINQ queries involving dynamic component and related entities?
NHibernate supports dynamic components, where dynamic/additional properties are stored in an IDictionary property of the POCO (e.g. via dynamic-component in hbm.xml). Dynamic/additional properties can be simple or relations/associations (one-to-many, many-to-one, etc.). I know how to use LINQ queries with conditions over simple additional properties, e.g. session.Query<Customer>().Where(c => c.DynamicProperties["DynProp"]) == "XXX") This also works with LINQ queries over associated/related entities, e.g. session.Query<Customer>().Where(c => ((AssocEntity)c.DynamicProperties["DynAssoc"]).Name == "XXX") However, how would I instruct the query to fetch associated entities when they are a dynamic component part? Something like .Fetch(p => p.DynamicProperties["DynAssoc"]) Throws the following exception: *ArgumentException: A fetch request must be a simple member access expression* Note that I do not want to change my NHibernate config to drive the eager fetching (if that is possible at all), since it should be part of the query. I need the feature as I am getting LINQ queries (from an ODATA interface) that need to be executed and specifically need the dynamic part of the component mapping. Any idea how/if this can be done? -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nhusers/69fffa06-5d66-4ae5-a312-c717867fa542n%40googlegroups.com.