This question is locked. New answers and comments are not allowed.
I have an Domain Model which has a one to many relationship between two objects, in this case a Header and Details record.
I would like to query the header records and also return its associated details records at the same time and so far I have used the following fetch strategy which works fine.
What I would like to do is filter the detail records that are returned at part of the fetch strategy, however this is were things start to fall apart.
According to this article http://blogs.telerik.com/blogs/posts/10-07-21/new-fetch-optimization-api.aspx, and I quote
"Last but not least, we will introduce collection filtering and users will be able to narrow the range of loaded objects to only those that are absolutely necessary. For example, it will be possible to load only shipped orders in the last year by providing the right lambda criteria."
This is almost exactly what I want to achieve and according to the .LoadWith method in the API documentation (http://www.telerik.com/help/openaccess-orm/topic76.html) I should be able to achieve this with a lambda expression.
So far I have tried this, however I keep on getting the error "Invalid FetchStrategy definition or FetchMember specification."
Could someone please shed some light on where I am going wrong, or even if this is actually possible?
Ideally what I would like to achieve is return the header record along with the LATEST detail record determined by the date the details record was inserted.
Thanks,
Kevin
I would like to query the header records and also return its associated details records at the same time and so far I have used the following fetch strategy which works fine.
Dim fetchStrategy As New Telerik.OpenAccess.FetchOptimization.FetchStrategy()
fetchStrategy.LoadWith(Of Fabs.OA.AccountHeader)(Function(h) h.AccountDetails)
Me.Context.FetchStrategy = fetchStrategy
Dim results4 = (From h In Me.Context.AccountHeaders).ToList
What I would like to do is filter the detail records that are returned at part of the fetch strategy, however this is were things start to fall apart.
According to this article http://blogs.telerik.com/blogs/posts/10-07-21/new-fetch-optimization-api.aspx, and I quote
"Last but not least, we will introduce collection filtering and users will be able to narrow the range of loaded objects to only those that are absolutely necessary. For example, it will be possible to load only shipped orders in the last year by providing the right lambda criteria."
This is almost exactly what I want to achieve and according to the .LoadWith method in the API documentation (http://www.telerik.com/help/openaccess-orm/topic76.html) I should be able to achieve this with a lambda expression.
So far I have tried this, however I keep on getting the error "Invalid FetchStrategy definition or FetchMember specification."
Dim fetchStrategy As New Telerik.OpenAccess.FetchOptimization.FetchStrategy()
fetchStrategy.LoadWith(Of Fabs.OA.AccountHeader)(Function(h) h.AccountDetails.OrderByDescending(Function(d) d.DateInserted))
Me.Context.FetchStrategy = fetchStrategy
Dim results4 = (From h In Me.Context.AccountHeaders).ToList
Could someone please shed some light on where I am going wrong, or even if this is actually possible?
Ideally what I would like to achieve is return the header record along with the LATEST detail record determined by the date the details record was inserted.
Thanks,
Kevin