andrewdavey / postal

Email sending for asp.net mvc using the view engine system to render emails.
http://aboutcode.net/postal
MIT License
536 stars 168 forks source link

Mark Postal.Email.Send method as virtual #90

Closed tuespetre closed 9 years ago

tuespetre commented 10 years ago

Currently, we can use member hiding (new keyword) to extend the behavior of Postal.Email.Send:

class CustomEmail : Postal.Email
{
    public MailAddressCollection Recipients { get; set; }

    public string CrazySpecialProperty { get; set; }

    public new void Send()
    {
        // record stuff in the database here

        base.Send();
    }
}

My suggestion is that Postal.Email.Send be marked virtual so that derivative classes may have the option of overriding it. As it stands today, any extended Send behavior would be lost if the custom email class was cast to its base class.

migig commented 9 years ago

+1 we also need this

migig commented 9 years ago

@tuespetre Why close this? It hasn't been addressed has it?

tuespetre commented 9 years ago

I was able to satisfactorily move behavior out of the Send method and I don't want it on my issue list any more. I wouldn't blame you for opening your own though ;)

migig commented 9 years ago

@tuespetre Okay I may do that :)

Though I think this library may be abandonware, so not sure it matters :(