IdeaBlade.Linq Assembly > IdeaBlade.Linq Namespace > DynamicQueryExtensions Class : ToPredicate<T> Method |
'Declaration
<ExtensionAttribute()> Public Shared Function ToPredicate(Of T)( _ ByVal predicate As IPredicateDescription _ ) As Expression(Of Func(Of T,Boolean))
'Usage
Dim predicate As IPredicateDescription Dim value As Expression(Of Func(Of T,Boolean)) value = DynamicQueryExtensions.ToPredicate(Of T)(predicate)
[Extension()] public static Expression<Func<T,bool>> ToPredicate<T>( IPredicateDescription predicate )
public void UsingToPredicate() { var expr1 = new PredicateDescription(typeof(Product), "UnitPrice", FilterOperator.IsGreaterThanOrEqualTo, 24); var exprFunc = expr1.ToPredicate<Product>(); var results = manager.Products.Where(exprFunc).ToList(); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2