Hy Guys, I'm working on an ASP.Net Project. Actually I'm making my database with codefirst and building the relations between entities. But i'm getting an error on my last stage. My Entity code is,
- public class Product
- {
- public int ProductId { get; set; }
- [Required]
- [StringLength(30)]
- public string Name { get; set; }
- [Required]
- public string Description { get; set; }
- public bool Sugar { get; set; }
- public bool Featured { get; set; }
- public DateTime ArrivalTime { get; set; }
- public int FoodCategoryId { get; set; }
- public FoodCategory FoodCategory { get; set; }
- public int BrandId { get; set; }
- public Brand Brand { get; set; }
- public Guid FileDetailId { get; set; }
- [ForeignKey("FileDetailId")]
- public virtual FileDetail FileDetail { get; set; }
- public virtual ICollection
Reviews { get; set; } - }
- public class FileDetail
- {
- public Guid Id { get; set; }
- [Required]
- public string FileName { get; set; }
- [Required]
- public string Extension { get; set; }
- }
Introducing FOREIGN KEY constraint 'FK_dbo.Products_dbo.FileDetails_FileDetailId' on table 'Products' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint or index. See previous errors.
Can anyone help me please?

Faisal PathanPosted May 30, 2018, 12:05 AM