Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To Do This Query
Message
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Titre:
How To Do This Query
Divers
Thread ID:
01528772
Message ID:
01528772
Vues:
91
I have 3 tables in a typical one-to-many-to-many relationship.
tblClientProjectProducts
    |_mmlClientProjectProductsParts
        |_tblClientProjectParts
I'm trying to create a query that returns a list of ClientProjectProductModel objects. This ClientProjectProductModel model
has a list property called Parts. I want that populated also. So far I have
List<ClientProjectProductModel> retVal = 
    (from products in context.tblClientProjectProducts
    join mml in context.mmlClientProjectProductsParts on products.ProductId equals mml.ProductId
    join parts in context.tblClientProjectParts on mml.PartId equals parts.PartId
    where products.ClientProjectId == ClientProjectId
    select new ClientProjectProductModel
    {
        ProductId = products.ProductId,
        ProductNumber = products.ProductNumber,
        ProductSeries = products.ProductSeries,
        Parts =                                      <=== What goes here?
    }).ToList();
I'm unsure as to how to add in the parts. Can someone show me how to do this>

Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform