Linq2Caml cannot reference properties in Entity base class


You have a base class for some of your entities with common properties
public class EntityBase { public string Name {get;set;} }
And you have a derived entity
public class Person : EntityBase { }
A (Linq2CAML) query on the person class could reference the Name property in the previous version, but throws an Exception in 1.3.2.
that is: (person=>person.Name.StartsWith('Jul')) fails.
The problem seems to be SPGENLinqExpressionTreeVisitor::FindOwnerProperty.
It contains a check to see that the Declaring type is exactly equal to TEntity.
If I add:
if (typeof(TEntity).IsSubclassOf(pInfo.DeclaringType))
return pInfo;
my application works. But I have no idea if this breaks something else.


tore7506 wrote Jan 17, 2012 at 2:36 PM

This has been confirmed as an issue. It will be fixed in the next release.

Thank you for reporting this issue.


wrote Jan 18, 2012 at 8:04 PM

wrote Feb 14, 2013 at 2:13 AM

wrote May 16, 2013 at 7:49 AM

wrote May 16, 2013 at 7:49 AM

wrote Jun 14, 2013 at 6:55 AM