I'm using Entity Framework Core and have a simple 5 table design, but get an error and can't figure out why. What am I missing?
Exception:
Introducing FOREIGN KEY constraint 'FK_GraphicItems_GraphicUploadTemplateItems_GraphicUploadTemplateItemId' on table 'GraphicItems' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Base:
public abstract class Base
{
public int Id { get; set; }
public DateTime DateCreated { get; set; } = DateTime.Now;
}
Client:
public class Client : Base
{
public Guid Key { get; set; }
public string Name { get; set; }
}
Graphic:
public class Graphic : Base
{
public int ClientId { get; set; }
public virtual Client Client { get; set; }
public ICollection<GraphicItem> Items { get; set; } = new HashSet<GraphicItem>();
public ICollection<Tag> Tags { get; set; } = new HashSet<Tag>();
}
GraphicItem: (the property GraphicUploadTemplateId causes the exception)
public class GraphicItem : Base
{
public int GraphicId { get; set; }
public virtual Graphic Graphic { get; set; }
public int GraphicUploadTemplateItemId { get; set; }
public virtual GraphicUploadTemplateItem UploadTemplateItem { get; set; }
}
GraphicUploadTemplate:
public class GraphicUploadTemplate : Base
{
public int ClientId { get; set; }
public virtual Client client { get; set; }
public ICollection<GraphicUploadTemplateItem> Items { get; set; }
}
GraphicUploadTemplateItem:
public class GraphicUploadTemplateItem : Base
{
public int GraphicUploadTemplateId { get; set; }
public virtual GraphicUploadTemplate UploadTemplate { get; set; }
}