Troube with predicate

Posts   
 
    
newb
User
Posts: 1
Joined: 26-Apr-2010
# Posted on: 26-Apr-2010 18:33:49   

I am new to LLBLGen Pro and am checking for duplicates and have the following SQL:


select a.TopicId,atc.TopicCategoryId,a.Headline
from article a
inner join ArticleTopicCategory atc on atc.ArticleId = a.Id
where a.TopicId = 'C0064FAE-093B-466E-8745-230534867D2F'
and a.Headline = 'Test'
and atc.TopicCategoryId in ('004D64F7-474C-48F9-9887-17B1E7532A84')

Whenever I step though my function, it always returns 0:


public bool CheckDuplicateArticle(Guid topicId, List<Guid> categories, string headline)
        {
            ArticleCollection articles = new ArticleCollection();
            PredicateExpression filter = new PredicateExpression();
            RelationCollection relation = new RelationCollection();
            relation.Add(ArticleEntity.Relations.ArticleTopicCategoryEntityUsingArticleId);
            filter.AddWithAnd(ArticleFields.TopicId == topicId);
            filter.AddWithAnd(ArticleTopicCategoryFields.Id == categories);
            filter.AddWithAnd(ArticleFields.Headline == headline);
            articles.GetMulti(filter, 0, null, relation);
            return articles.Count > 0;
        }

Any help would be appreciated!

Seth avatar
Seth
User
Posts: 204
Joined: 25-Mar-2006
# Posted on: 26-Apr-2010 21:20:15   

Have you tried LINQ? It is a lot easier.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Apr-2010 05:00:47   
David Elizondo | LLBLGen Support Team
Joop avatar
Joop
User
Posts: 43
Joined: 07-Aug-2008
# Posted on: 28-Apr-2010 12:24:36   

Which database engine are you using? Are you sure you use the same values as in your SQL query example?

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 28-Apr-2010 13:02:33   

Please check the generated SQL, see if it matches the SQL in mind. Try to execute manualy against the database, and see if the database returns any results. Check your configuration settings and make sure your code targets the same database.