logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne2  
#1 Posted : Monday, February 8, 2021 7:24:36 AM(UTC)
Joe Payne2

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();
        }

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Joe Payne2  
#2 Posted : Monday, February 8, 2021 8:15:27 AM(UTC)
Joe Payne2

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)


shaharyartiwana25816656  
#3 Posted : Monday, February 8, 2021 11:29:05 PM(UTC)
shaharyar

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.

thanks 1 user thanked shaharyar for this useful post.
Joe Payne2 on 2/9/2021(UTC)
Joe Payne2  
#4 Posted : Tuesday, February 9, 2021 4:47:00 AM(UTC)
Joe Payne2

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!
Users browsing this topic
Guest
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.