public override bool BuildWhere(ExtentStatement statement, string alias) { var schema = statement.Schema; if (this.instanceClasses.Length == 1) { statement.Append(" (" + statement.GetJoinName(this.association) + "." + schema.TypeId + " IS NOT NULL AND "); statement.Append(" " + statement.GetJoinName(this.association) + "." + schema.TypeId + "=" + statement.AddParameter(this.instanceClasses[0].Id) + ") "); } else if (this.instanceClasses.Length > 1) { statement.Append(" ( "); for (var i = 0; i < this.instanceClasses.Length; i++) { statement.Append(" (" + statement.GetJoinName(this.association) + "." + schema.TypeId + " IS NOT NULL AND "); statement.Append(" " + statement.GetJoinName(this.association) + "." + schema.TypeId + "=" + statement.AddParameter(this.instanceClasses[i].Id) + ")"); if (i < this.instanceClasses.Length - 1) { statement.Append(" OR "); } } statement.Append(" ) "); } return(this.Include); }