I have the following code-first entity -
public class Contact
{
public Contact()
{
this.Tags = new HashSet<Tag>();
}
public int ContactId { get; set; }
public string ContactName { get; set; }
public virtual ICollection<Tag> Tags { get; set; }
}
public class Tag
{
public Tag()
{
this.Contacts = new HashSet<Contact>();
}
public int TagId { get; set; }
public string TagName { get; set; }
public virtual ICollection<Contact> Contacts { get; set; }
}
I would like to search a contact based on Tags property from an string array. Something like the following-
//string[] tags
Select from Db.Contacts where any Tag matched with any item in arrTags
I could not figure out how it can be done in lambda. Any help?
You can try this
EDIT:
To get matching contacts