I need to store a file in conjunction with a database entry. How can I override the Remove method of the DbContext so that both the entry and file are deleted?
I need to store a file in conjunction with a database entry. How can
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You can override the
SaveChangesmethod, as described here: Entity Framework 4.1 DbContext Override SaveChanges to Audit Property ChangeJust add your own case for removals of specific entity types.