I am using in my project angular, breeze, WebApi, EF, SqlServer2008. I have table Articles and table ArticleComments, So one article can have many articleComments records.
public class Article{
public int ArticleId { get; set; }
public string ArticleName { get; set; }
public string Description { get; set; }
public ICollection<ArticleComment> Comments { get; set; }
public ICollection<ArticleImage> ImagesList { get; set; }
...
}
public class ArticleComment
{
public int ArticleCommentId { get; set; }
public string CommentText { get; set; }
public int UserId { get; set; }
public int Rate { get; set; }
public DateTime CommentDate { get; set; }
public int ArticleId { get; set; }
public Article Article { get; set; }
public int Status { get; set; }
}
in client I need to get full Article entity with comments, images and others linked entities, But comments need to be only for selected article record and where field "status" == 1.
I try to use such query
var pred = breeze.Predicate.create('articleId', 'eq', id)
.and('comments', 'any', 'status', '==', 1);
return EntityQuery.from("Articles")
.where(pred)
.expand('comments, imagesList...')
.toType(entityNames.article)
.using(manager).execute()
.to$q(querySucceded, self._queryFailed);
this returns all comments for article , but does not filter expanded table ArticleComments by status field.