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 8116525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:51:53+00:00 2026-06-06T03:51:53+00:00

I am using Entity Framework, C# 4.0 and Visual Studio 2010. I need to

  • 0

I am using Entity Framework, C# 4.0 and Visual Studio 2010. I need to execure a simple SQL query to delete the content of four tables. The query contains:

DELETE FROM dbo.tblMFile
DELETE FROM dbo.tblMContacts
DELETE FROM dbo.tblPersonDetails
DELETE FROM dbo.tblAddresses

There is a foreign key contraint between some of the tables.

There seems to be no simple way to do this.

With reference to my comments on the first respondant’s answer:

  • Because of the highly confidential nature of the data I NEED a way to quickly delete all content (a requirement and a security issues)

  • I am new to EF and keen to learn

  • I am using delete instead of truncate because of the foreign key constraints mentioned above (also the SQL above is illustrative, not definitive).

  • I am a firm and long time believer in strong typing and prefixes all my objects with a type indicator. It has saved me hours (or days even) of debugging.

  • Humans are polite, sensitive and informative (among many other attributes). I aspire to be human.

  • 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-06T03:51:55+00:00Added an answer on June 6, 2026 at 3:51 am

    To add to the answer from @TomTom. You can’t do that directly using Entity Framework. But you can:

    • create a stored procedure to delete the records (it can also take the table name as parameter)
    • use ExecuteStoreQuery see see and write the SQL command directly
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Visual Studio 2010 RTM with .NET/Entity Framework 4 RTM with a model
I'm using Entity Framework in Visual Studio 2010 Beta 2 (.NET framework 4.0 Beta
To begin with: Using Entity Framework v4.0. ASP.NET MVC 2.0. Visual Studio 2010. I
My scenario I'm using Visual Studio 2010 with Entity Framework 4.1 I have a
I've created a web application project in Visual Studio 2010 using Entity Framework Code
I have a MVC 2 project, using Entity Framework, in Visual Studio 2010 and
I am using the latest beta of Visual Studio 2010 and the Entity Framework.
I am using C#, Visual Studio 2010 and Entity Framework 4. I have an
I am using Entity framework with following tools: MS Visual studio 2010 Professional SP1
In Visual Studio 2010, my solution was using .NET 4.2 (Entity Framework June 2011

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.