.net - Entity FrameWork Filter Navigation Properties Does Not Work -


i realised need filter out entities navigation property in ef. found microsoft's own page on this:

https://msdn.microsoft.com/en-us/data/jj574232#explicitfilter

i have copied code vb.net closely can entities. changed filter after did not work should filter out (id = -99). still did not work. gets invoice not filter of related invoice details.

dim inv = mybase.context.invoices.include(function(x) x.invoicedetails).where(function(x) x.id = id).firstordefault  mybase.context.entry(inv).collection(function(x) x.invoicedetails).query().where(function(d) d.id = -99).load()  dim cc = inv.invoicedetails.count  if cc > 1  debug.write(cc)''this should not run should filtered out  end if 

any ideas? code seems match thiers closely. have tried , without ".include".

note not possible filter related entities loaded. include bring in related entities.

entity framework team working on it. upcoming feature

request feature

please see explicit filter

linq query - how sort , filter on eager fetch


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -