Cascade Dell with two primary Keys

  • I am trying to Implement Cascade delete but getting Error in the Calling C# code. Attached is how my table looks like. Any help will be appreciate. I am Implementing the delete with MVC C#

    private void DeleteNewsFeed(int p)

    {

    try

    {

    var feeds = _uow.RepositoryAsync<Feed>().Find(p);

    if (feeds == null) return;

    _uow.RepositoryAsync<Feed>().Delete(feeds);

    _uow.SaveChanges();

    }

    catch (Exception ex)

    {

    ControllerProvider.ProcessDataAccessLayerException(ex);

    ControllerUnHandledExp.LogError(ex);

    throw;

    }

    }

  • Hi Kdanaipam,

    This is a SQL server forum. However is there any SQL error you are getting? What do you mean by cascade delete? have you created the FK with' on delete cascade'?

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Yes, I have Implemented Foreign Keys with on delete cascade but getting error unable to delete on multiple keys

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply