Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #19 from pedroreys/FixNoConfigurationIssue
Browse files Browse the repository at this point in the history
Skip FilterQueryVisitor when can't find config metadata
  • Loading branch information
jbogard committed Aug 31, 2016
2 parents 2ee9bc0 + 5810f3d commit c100a6e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/EntityFramework.Filters/FilterQueryVisitor.cs
Expand Up @@ -25,7 +25,12 @@ public FilterQueryVisitor(DbContext contextForInterception)
public override DbExpression Visit(DbScanExpression expression)
{
// a bit harder to get the metadata in CSpace
var item = expression.Target.ElementType.MetadataProperties.First(p => p.Name == "Configuration");
var item = expression.Target.ElementType.MetadataProperties.FirstOrDefault(p => p.Name == "Configuration");

if(item == null)
{
return base.Visit(expression);
}

// using reflection to get the Annotations property as EntityTtypeConfiguration is an internal class in EF
Dictionary<string, object> annotations = new Dictionary<string, object>();
Expand Down Expand Up @@ -105,4 +110,4 @@ public static object GetAnnotation(IEnumerable<MetadataProperty> metadataPropert
return metadataProperty == null ? null : metadataProperty.Value;
}
}
}
}

0 comments on commit c100a6e

Please sign in to comment.