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

  • SEARCH
  • Home
  • 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 8036095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:30:26+00:00 2026-06-05T02:30:26+00:00

I’m pulling out my hair here. I’ve seen the solutions to turning off cascade

  • 0

I’m pulling out my hair here. I’ve seen the solutions to turning off cascade on delete here, but I can’t implement it. I don’t know what I’m doing wrong here, but I keep getting the below error:

‘System.Data.Entity.ModelConfiguration.EntityTypeConfiguration’ does not contain a definition for ‘WillCascadeOnDelete’ and no extension method ‘WillCascadeOnDelete’ accepting a first argument of type ‘System.Data.Entity.ModelConfiguration.EntityTypeConfiguration’ could be found (are you missing a using directive or an assembly reference?)

I’ve added the necessary namespaces, but I don’t see it as an option anywhere in the intellisense and I’m not getting anywhere searching. I’m in VS 2010 MVC 3

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using vf2.Models;
using vf2.Models.LinkTables;
using vf2.Models.Requests;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.Entity.ModelConfiguration.Configuration;
using System.Data.Entity.ModelConfiguration;
using vf2.Models.Reporting;
using vf2.Models.POSObj;

namespace vf2.Models
{
    public class vfContext : DbContext
    {
        public DbSet<App> Apps { get; set; }
        public DbSet<Origin> Origins { get; set; }
        public DbSet<WineType> WineTypes { get; set; }
        public DbSet<VarType> VarTypes { get; set; }
        public DbSet<Wine> Wines { get; set; }
        public DbSet<Vintage> Vintages { get; set; }

        public DbSet<Distributor> Distributors { get; set; }
        public DbSet<Importer> Importers { get; set; }
        public DbSet<Producer> Producers { get; set; }
        public DbSet<Publication> Publications { get; set; }
        public DbSet<Review> Reviews { get; set; }
        public DbSet<UserType> UserTypes { get; set; }
        public DbSet<Restaurant> Restaurants { get; set; }

        public DbSet<WineListChangeRate> WineListChangeRates { get; set; }
        public DbSet<MenuChangeRate> MenuChangeRates { get; set; }
        public DbSet<WineListCount> WineListCounts { get; set; }

        public DbSet<UserObj> UserObjs { get; set; }
        public DbSet<ProducerUser> ProducerUsers { get; set; }
        public DbSet<DistributorUser> DistributorUsers { get; set; }
        public DbSet<RestaurantUser> RestaurantUsers { get; set; }

        public DbSet<ProducerEditRequest> ProducerEditRequests { get; set; }
        public DbSet<RequestStatus> RequestStatuses { get; set; }
        public DbSet<VOAVIRequest> VOAVIRequests { get; set; }

        public DbSet<POS> POSs { get; set; }
        public DbSet<Cart> Carts { get; set; }
        public DbSet<FutureUser> FutureUsers { get; set; }
        public DbSet<Doc> Docs { get; set; }
        public DbSet<DocType> DocTypes { get; set; }

        public DbSet<WineVisit> WineVisits { get; set; }


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {

            modelBuilder.Entity<Review>().WillCascadeOnDelete(false);
//error here!

            base.OnModelCreating(modelBuilder);
        }
    }
}
  • 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-05T02:30:28+00:00Added an answer on June 5, 2026 at 2:30 am

    “Cascading delete” is a configuration of a relationship, not of an entity/table. Hence WillCascadeOnDelete is a method of CascadableNavigationPropertyConfiguration. Use case example:

    modelBuilder.Entity<Review>()
        .HasRequired(r => r.Wine)
        .WithMany()
        .WillCascadeOnDelete(false);
    

    It means that if a wine is deleted from the catalog in the database, it’s reviews should not be deleted together with the wine. That’s a property of this specific relationship, not of the Reviews table.

    In this case trying to delete a wine which has reviews would result in a foreign key constraint violation and exception of course, but that is what you usually want when you disable cascading delete on a required relationship (“Don’t allow to delete a wine which has reviews, only allow it for wines which haven’t any…”).

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I don't have much knowledge about the IPv6 protocol, so sorry if the question

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.