public class Article
{
public List<Category> _ArticleCategory;
public Article()
{
_ArticleCategory = new List<Category>();
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ArticleID { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Content { get; set; }
public int Viewed { get; set; }
public DateTime LastUpdatedDate { get; set; }
public bool IsDeleted { get; set; }
public virtual List<Category> Categories { get; set; }
public virtual List<Tag> Tags { get; set; }
public virtual List<Comment> Comments { get; set; }
}
// I want to take Articles which has more than 1 Category
var result = _context.Articles.Where(a => a.Categories.Count > 1).ToList();
There is my Article Class and my code to take Articles.There i no problem from _Context or somewhere else. It is giving me all Articles. How can i make conditions for that ? Thanks Guys..
Thanx everybody.. I solved the proplem..
public virtual List<Category> Categories { get; set; }
public virtual List<Tag> Tags { get; set; }
public virtual List<Comment> Comments { get; set; }
//this.Configuration.LazyLoadingEnabled = false; I should open this property when ı want to use virtual list options.Thanx again.. Happy Coding :)