Пытаюсь установить связь, с таблицей другой в asp net core, у меня выдает ошибку:
The property 'Name' is not a navigation property of entity type 'Product'. The 'Include(string)' method can only be used with a '.' separated list of navigation property names.
Мой код:
Модель ProductDetail
[ForeignKey("Product")]
public int? ProductId { get; set; }
[ForeignKey("ProductId")]
public virtual Product Product { get; set; }
public int? CategoryId { get; set; }
public virtual Category Category { get; set; }
public int Count { get; set; }
Модель Product
public class Product
{
[Required] public string Name { get; set; }
public virtual IEnumerable<ProductDetail> ProductDetail { get; set; }
}
Контроллер:
var blog2 = _context.ProductDetails
.Include(b => b.Product)
.ThenInclude(b => b.Name)
.FirstOrDefault();
Всякими способами пробывал установить связь - не работает.
Гугл перерыл - не работают там решение.
Заранее спасибо за помощь.