Asier
Asier

Reputation: 1

How to write a Linq to Entities query given a list of entities as parameter

I have 2 tables: Materials and Colors with two colums

Materials (guid and name)
Colors (guid and name)

One Material can have a lot of colors and a Color can be in a lot of Materials. (many to many relationship)

Using LINQ I can write Material.colors and this send me a list of the entities of color contained in that material.

I would like to make function in which I pass a list of Color and return what materials have those Colors.

I am writing in VB.net

Public Shared Function getMaterialsFromColor(vColors As List(Of Entities.Color)) As List(Of Entities.Materials)

    Dim _materials As New List(Of Entities.Materials)

    _materials.AddRange(From vmaterial as Entities.Materials where vmaterial.color.name=)

    '(this is the part that I dont know)
end function

thanks a lot

I am using sqlserver express and linq to entities (ado.net)

Upvotes: 0

Views: 56

Answers (0)

Related Questions