Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
I'm migrating customizations from Able Gold to AC9. One of my classes represents physical files uploaded to the user object. So there's a physical file associated with the entity. When the entity .Delete() is called, I want to delete the physical file before calling base.Delete(). This works great in Gold, but I'm not sure how I should be handling this in AC9. It doesn't appear the base entity class has a .Delete() method now. Any suggestions? Code:
public override void Delete()
{
// make sure the physical file is deleted
if (File.Exists(this.FilePath))
{
File.Delete(this.FilePath);
}
// fire the base delete routine
base.Delete();
}
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Looks like you're doing it now in the repository like this? Code:
public override void BeforeDelete(object entity)
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
Hi,
You should be doing this in the BeforeDelete function. This function was also available in Gold as well and we were using the same function for these kinds of operations.
|
1 user thanked shaharyar for this useful post.
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Ok that makes sense. Thanks!
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close