1

I have an asp.net web application in visual studio 2010. I am connected to an sql server using linq-to-entites objects and need to find out how to turn off cascading-deletes when i delete an object via a grid-view. Anybody know?

SHeinema
  • 634
  • 5
  • 14
  • 34

1 Answers1

1

Go to the model browser. Then click on the association and view the properties. There is a property for On Delete that you can set to either Cascade or none. Select none.

xbrady
  • 1,683
  • 14
  • 23
  • Hmmmm...well...I found the setting, it was already on 'none' but for some reason my deletes are still cascading. Anything else you can think of that might cause that? – SHeinema Jan 30 '12 at 06:00
  • Is it enabled on the relationship in the database? – xbrady Jan 30 '12 at 06:02
  • Sorry, I'm somewhat of a n00b with VisualStudio...Do you know where in the server-explorer I might check for that setting, I'm not seeing it.. – SHeinema Jan 30 '12 at 06:06
  • Which database server are you using? It would be in the database server settings. Do you have a DBA that manages your database? – xbrady Jan 30 '12 at 06:23
  • Yes I will need to contact the DBA, however in the meantime I found a temporary solution was to break the relationship when no longer needed. In my app this will prevent the cascade delete from affecting anything important. Thanks for the help! – SHeinema Jan 30 '12 at 06:29