/// <summary>Visits a type binary expression.</summary> /// <param name="expression">Expression to be visited.</param> /// <returns>Expression visited</returns> protected override System.Linq.Expressions.Expression VisitTypeBinary(System.Linq.Expressions.TypeBinaryExpression expression) { var classMappings = MappingsRepository.FindMappedClasses(expression.TypeOperand); if (classMappings.Any()) { Remotion.Linq.Clauses.FromClauseBase sourceExpression = GetSourceExpression(expression.Expression); StrongEntityAccessor entityAccessor = _query.FindAllComponents <StrongEntityAccessor>().FirstOrDefault(item => item.SourceExpression == sourceExpression); if (entityAccessor == null) { entityAccessor = this.GetEntityAccessor(sourceExpression); _query.Elements.Add(entityAccessor); } EntityTypeConstrain typeConstrain = this.CreateTypeConstrain(expression.TypeOperand, entityAccessor.SourceExpression.FromExpression); _lastComponent = typeConstrain; if ((_currentComponent.Count > 0) && (_currentComponent.Peek() is BinaryOperatorNavigator)) { HandleComponent(typeConstrain); } else if (!entityAccessor.Elements.Contains(typeConstrain)) { entityAccessor.Elements.Add(typeConstrain); } } else { return(base.VisitTypeBinary(expression)); } return(expression); }