I've faced a problem that is:
An exception of type 'System.ArgumentException' occurred in EntityFramework.dll but was not handled in user code
Additional information: The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation properties.
How can I solve it?
This problem happen in FindAll
method
articleViewModel.AttachmentFiles = AttachmentFileBLL.Instance.FindAll(c => c.ArticleId == articleViewModel.Id).ToList();
FindAll method:
public virtual IQueryable<TModel> FindAll(params Expression<Func<TModel, object>>[] includeProperties)
{
IQueryable<TModel> items = RepositoryContainer<TRepository>().FindAll();
if (includeProperties != null)
{
foreach (var includeProperty in includeProperties)
{
items = items.Include(includeProperty); // Problem occurred here!
}
}
return items;
}
public virtual int? ArticleId { get; set; }
public virtual int Id { get; set; }