EFDAL: Where Clause on Derived Table

May 19, 2011 at 4:26 AM

I have two tables in a derived relationship:

AssetID (int; key)

FixedAsset : Asset

The following construct won't compile (Context is the entity/object context object):

 Context.FixedAsset.Where(fa => fa.AssetID == someValue)

It complains about needing a Func<FixedAsset, int, bool>.

- Mark

May 19, 2011 at 4:29 AM

Never mind, my goof. The full line which was having a problem was:

FixedAsset fa = Context.FixedAsset.Where(fa => fa.AssetID == assetID).SingleOrDefault();

and obviously "fa" can't be both a local variable and a lambda expression variable.

- Mark

May 19, 2011 at 8:18 PM

Great. I am glad it is solved.