Saturday, 15 February 2014

c# - Entity Framework: Call a function after an object is removed from the database -


I am currently working on an ASP.NET mvc project which allows the user to upload files to the server , And can associate them with other things

  public class file attachment {[key] public id id {get; Set; } Public string title {get; Set; } Public String ContentType {get; Set; } Public string extension {get; Set; } [Foreigner ("donor")] {receives public insurance payer ID; Set; } Public Virtual Donor (Received; Set; }} Public Class Donor {[Key] Public Ent ID {get; Set; } // Official virtual list & lt; FileAttachment & gt; Attachments {Get; Set; }}   

I am thinking that if there is a way to specify a function for the Entity Framework, when the donor or file attachment object is removed from the DBST, because the attachments are stored in File system therefore I need to make sure that the file is deleted.

To notify when their data changes If you design your database it is very easy This is managing attachment files, not your application.

I'm not sure which database you are using, but if you are using Microsoft SQL Server, then you need to use it.

No comments:

Post a Comment