I'm using the F# SqlDataConnection data provider to access a database. The code works fine except that it goes to the database for every single nested record. How do I get the query to prefetch some of these records
module Local =
type Db = SqlDataConnection<"Server=.;Database=CCTFundDb;Trusted_Connection=True">
let db =
let ctx = Db.GetDataContext()
let dataOptions = Data.Linq.DataLoadOptions()
dataOptions.LoadWith<Db.ServiceTypes.MemberSubscriptions>(fun p->p.AccountingBooks.AccountingBookEntries |> box)
ctx.DataContext.LoadOptions <- dataOptions
ctx
let _ = db.DataContext.Log <- Console.Out
If I remove the |> box, it gives the error that it is expecting obj. When I execute in fsx, it complains about the expression.
How do I do this? If it is not possible, is there another type provider that supports loading the data in batches?