我是新來LLBLGEN Pro和我檢查重複,我有以下SQL:LLBL根謂詞過濾
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')
每當我一步,雖然我的功能,它總是返回0:
LLBLGEN代碼:
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;
}
任何幫助,將不勝感激!
解決filter.AddWithAnd(ArticleTopicCategoryFields.Id ==類別);本來應該filter.AddWithAnd(ArticleTopicCategoryFields.ArticleId ==類別);但是,這是LLBL幫助的感謝有用的鏈接!另外,關於爲了提高效率,我使用了GetDbCount而不是GetMulti來返回結果集的計數。 – Neil 2010-04-28 19:47:11