This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, In some of the SQL queries that I have in my old projects, I have complex part of query encapsulated in function which is used in many function. I have seen on the link below that it's possible to reproduce the same feature with linq. http://www.albahari.com/nutshell/predicatebuilder.aspx using System; |
|
|
Use a simplified form of PredicateBuilder: public static class PredicateBuilder2 Now you should be good to go: [Test] I'm not sure what additional work Expression.Invoke is doing in Joe's PredicateBuilder class: I'm guessing there are some additional edge cases that he needs to handle that I'm not doing. But the simplified version works for me in the simple cases shown. |
|
|
Thank you again for your very very fast answer. I have tested your sample and it work perfectly. For other who read this post, here is the sample of my code: Public Class Specification(Of T As Mindscape.LightSpeed.Entity)
I have used the 'And' and 'Or' operator because this is very easy to use. Dim testUnitOfWork As Domain.Models.LightSpeed.ModelUnitOfWork = Domain.Data.DataContext.CreateUnitOfWork
You can also you nested predicate like " Expression And (Expression Or Expression) " It work very well in my cases.
Ivan, you are my hero in orm. I have to talk a lot with Telerik guys because we use there controls but your support service is not comparable. Like you said, you have a legendary support.
I will not say enough, Thank you very much. |
|
|
I'm trying to use PredicateBuilder as well and was able to get around this problem by using either the AsExpandable or Expand extension methods in the LinqKit library. |
|