I am using a dynamic way of including "parent properties" when i am retrieving entities from the db. However, since that checks if the property is a value type (or string) or an ienumerable of something (excluding those), it will also include entities that are defined as complextypes. This will lead to an exception.
Is it possible to check if an entity has been defined as a complex type?
Please see this example code:
public IEnumerable<object> LookupExtent(Type type)
{
var set = Set(type);
DbQuery q = null;
foreach (var prop in type.GetParentProperties())
{
if (q == null)
q = set.Include(prop.Name);
else
q = q.Include(prop.Name);
}
return q.ToObjectArray();
}
PS: Yes i know this will fail if i have no parent properties...