I have been testing out EF 4 and am looking to filter child collections on an object.
I'm using POCO support and have EF wiring up my collections automatically:
public virtual ICollection<Product> Products { get; set; }
So in this example, I can get an instance of a category and then enumerate it's products.
What I want to know, is how I can then filter this collection, say to return only active products. I know I can do this in memory but it is important that the criteria is sent direct to the database.
In NHibernate I can do this using filters on my collection, is there something equivalent in EF 4?
I did think about creating another collection e.g.
public virtual ICollection<Product> ActiveProducts {get;set;}
but am unsure how to then wire this up.
Thanks, Ben