This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi there I'm a developer at a co tha tuses MSLS but I don't have it on my machine, ergo updating aspects of the design of an .lsmodel is not possible for me, but I can use what is already there. Here are the business rules:
I've got 3 nested asp repeaters:
I kick it all off with repeaterOuter.DataSource = UnitOfWork.Forums.Where(x => x.Owner = CurrentUser).ToArray() Problem is it doesnt include the Attachments that have been deleted. I looked in the .lsmodel and found:
I think this means I can somehow say Forum[index].Posts.WithAggregate("PostDetails"), because I've seen something like it in an EagerLoading tutorial video (talking about SKUs) and it will load all the Attachments, not just the nondeleted ones.. But if I try and put this .WithAggregate("...") in my aspx markup anywhere, the site crashes saying it doesnt exist as a method.. Any clues how I can bind up my repeaters so they will interrogate the LS model and load all the attachments, deleted or otherwise? Thanks |
|
|
Using Forum[index].Posts.WithAggregate("PostDetails") wont do what you are expecting as the Posts collection will either already be loaded or will be lazily loaded with enumeration but this is done by LightSpeed internally and not as part of a query so the aggregate name will be moot here. You can either eagerly load these as part of loading your original Forum instances by specifying the aggregate when loading those, e.g.
In this situation your Posts will also need to be eager loaded for this to ripple down to your Attachments. In terms of loading deleted instances, you can load deleted instances by a direct query (either using query objects or LINQ) but not as part of an association load. Associations will only ever contain active instances. If you do want to fetch deleted instances as part of a query you can use the .IncludeDeleted() extension method as part of your LINQ query - see this page in the docs for more details: http://www.mindscapehq.com/documentation/lightspeed/Implementing-Storage-Policies-with-LightSpeed/Soft-Deletion
|
|