public void ApplyFilter(FilterContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { var propertyName = String.Join(".", part.Name, field.Name, storageName ?? ""); // use an alias with the join so that two filters on the same Field Type wont collide var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // generate the predicate based on the editor which has been used Action<IHqlExpressionFactory> predicate = fieldTypeEditor.GetFilterPredicate(context.State); // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService Action<IHqlExpressionFactory> andPredicate = x => x.And(y => y.Eq("PropertyName", propertyName), predicate); // apply where clause context.Query = context.Query.Where(relationship, andPredicate); }
public void ApplyFilter(FilterContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { var propertyName = String.Join(".", part.Name, field.Name, storageName ?? ""); // use an alias with the join so that two filters on the same Field Type wont collide var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // generate the predicate based on the editor which has been used Action <IHqlExpressionFactory> predicate = fieldTypeEditor.GetFilterPredicate(context.State); // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService Action <IHqlExpressionFactory> andPredicate = x => x.And(y => y.Eq("PropertyName", propertyName), predicate); // apply where clause context.Query = context.Query.Where(relationship, andPredicate); }
public void ApplyFilter(FilterContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) { // The filter has to be applied only if there's an actual value (not null or empty) to filter with. if (context.State.Value != null && context.State.Value != "") { var propertyName = string.Join(".", part.Name, field.Name, storageName ?? ""); // Use an alias with the generated property name, so that two filters on the same Field Type won't collide. var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName()); // Generate the predicate based on the editor, which has been used. Action <IHqlExpressionFactory> predicate = fieldTypeEditor.GetFilterPredicate(context.State); // Combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService. Action <IHqlExpressionFactory> andPredicate = x => x.And(y => y.Eq("PropertyName", propertyName), predicate); // Apply where clause. context.Query = context.Query.Where(relationship, andPredicate); } }
public override Action <IHqlExpressionFactory> GetFilterPredicate(dynamic formState) { return(_editor.GetFilterPredicate(formState)); }