I think you're looking for ActiveRecordModel.GetModels() (or ActiveRecordModel.GetType(Type)). You can easily use that to reflect on the mapped relations/properties to build your eagerly-fetch query. Querying mappings at the NHibernate level is also possible but harder. Or you could just use standard .net reflection, e.g. get all properties in your Record class that have HasManyAttribute and use the properties from that HasManyAttribute to get mapped field, etc.
-- Mauricio On Thu, May 12, 2011 at 4:53 AM, JoshG <[email protected]>wrote: > Hi there, > > I have a class (record) that has a list of child objects on it that > have been set to "lazy" load. > I am looking to be able to do the following: > > SimpleQuery query = SimpleQuery(typeof(record), "from record o"); > query.SetFetchMode(Eager) > ExecuteQuery(query); > > Such that all relations on the record are automatically fetched with > eager mode. > > Unfortunately, I do not have a list of the properties that have these > lists in them. So I can't generate a proper HQL query or an ICriteria > query, as in both cases I would need to know the relevant properties > to set 'eager' on. > > I figure ActiveRecord has enough information available to it (since it > knows which properties are lazy) so it might have something that I can > use? > > Any ideas? > > Thanks > > Josh > > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected] > . > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
