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
|
I have the following setup in the database/Lightspeed designer: Application -> ApplicationBrand -> Brand I need to create a method that returns all associated Brands for a given application. I assumed I'd be able to do this:
So... I load the application, and return the associated Brands collection. But this actually returns a ThroughAssociation< ApplicationBrand, Brand >, and not the IQueryable< Brand > I was expecting (that Lighspeed usually returns for collections, such as UnitOfWork.Brands). How should I be using the Brands object? Should I simply add an AsQueryable() to the result? How should I be working with these ThroughAssociations? Thanks |
|
|
Associations and ThroughAssociations are properties on an entity which refer to LightSpeed managed collections (EntityCollection[T], ThroughAssociation[T, TOther] and neither of these implement IQueryable, they do however implement IEnumerable. You could return LoadById(applicationId).Brands.AsQueryable() since thats available on IEnumerable. If you are intending to leverage this for deferred queries (despite the set being in memory already) then go with IQueryable, otherwise I would return this as IEnumerable.
|
|