Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8997153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:51:00+00:00 2026-06-15T23:51:00+00:00

I have three model classes: User. Entry. EntryLikes. As follows: public class User {

  • 0

I have three model classes:

  1. User.
  2. Entry.
  3. EntryLikes.

As follows:

public class User
{
    [Required]
    public int ID { get; set; }

    [Required]
    [DataType(DataType.Text)]
    public string Name { get; set; }
}
public class Entry
{
    [Required]
    public int ID { get; set; }

    public int UserID { get; set; }
    [ForeignKey("UserID")]
    public virtual User User { get; set; }
}
public class EntryLike
{
    [Required]
    public int ID { get; set; }

    [Required]
    public int UserID { get; set; }
    [ForeignKey("UserID")]
    public virtual User User { get; set; }

    [Required]
    public int EntityID { get; set; }
    [ForeignKey("EntityID")]
    public virtual Entry Entry { get; set; }
}

Upon execution I got following exception:

Introducing FOREIGN KEY constraint
‘FK_dbo.EntryLikes_dbo.Entries_EntityID’ on table ‘EntryLikes’ 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. See previous errors.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:51:01+00:00Added an answer on June 15, 2026 at 11:51 pm

    Why do you have a foreign key relationship with User from EntryLike and from Entry? Given that you have a relationship between Entry and User on the Entry class, you don’t need one on the EntryLike class as it can be inferred due to the relationship between EntryLike and Entry. Also, should the foreign key id property on EntryLike be called EntryID rather than EntityID?

    EDIT: It’s because you have multiple cascade paths to your User – one is Entry > User and the other is EntryLike > Entry > User. You will need to switch cascade delete off to stop this error from occurring. The links I put in the comment should get you on the right track.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Model classes like so: Program: public class Program { public int
I have three model classes that look as below: class Model(models.Model): model = models.CharField(max_length=20,
I have the following model classes declared by SQLAlchemy: class User(Base): id = Column(Integer,
I have an STI model structure where super-class is User and sub-classes are Member
I have three models: class User include Mongoid::Document field :name, :type => String has_many
Can we have a model class which is singleton in Doctrine? For Singleton classes
I have this classes interface UserInterface Then abstract class user implements UserInterface Then i
In my model I have three complex scopes returning the Discount object arrays. Each
I have three models that are coming together to create one view model and
I have three models: User Image Group . User belongs to an image; Group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.