Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JobDisplayNameAttribute #993

Merged
merged 4 commits into from Mar 2, 2018

Conversation

@pieceofsummer
Copy link
Contributor

commented Sep 13, 2017

This should have been done a long time ago :)

Supports formatting:

[JobDisplayName("Test job ({0})")]
public static void TestJob(int arg)

Supports localization:

[JobDisplayName("TestJob_DisplayName", ResourceType = typeof(MyResources))]
public static void TestJob(int arg)

@odinserj odinserj changed the base branch from master to dev Mar 2, 2018

@odinserj odinserj merged commit f4ecd0c into HangfireIO:dev Mar 2, 2018

1 check was pending

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details

@odinserj odinserj self-requested a review Mar 2, 2018

@odinserj odinserj added this to the Hangfire 1.7.0 milestone Mar 2, 2018

@odinserj

This comment has been minimized.

Copy link
Member

commented Mar 2, 2018

Finally merged, @pieceofsummer, thanks for your efforts! 👍 👍 👍

@pieceofsummer

This comment has been minimized.

Copy link
Contributor Author

commented Mar 2, 2018

@odinserj I wonder if this should take precedence before display name provider? If yes, then NETFULL DisplayNameAttribute should too.

Looking back at this PR, I also think maybe we should unseal JobDisplayNameAttribute and make Format method virtual, so users may easily inherit custom attributes from it and implement their own naming. What do you think?

@odinserj

This comment has been minimized.

Copy link
Member

commented Mar 2, 2018

Right! I've just made the corresponding commits to implement these ideas.

@pieceofsummer

This comment has been minimized.

Copy link
Contributor Author

commented Mar 2, 2018

Great! Now I think the only thing left (before the major update to fully async model in 2.0) is to cancel the CancellationToken when the job is deleted from dashboard :)

@odinserj

This comment has been minimized.

Copy link
Member

commented Mar 2, 2018

I'll mark it with the 1.7.0 milestone then and check a bit later ("later" sounds dangerous, he-he) 😃

@ernecastro

This comment has been minimized.

Copy link

commented Mar 25, 2018

Hi all, I don't if I'm missing something, but this feature does not seem to work for me.

Having this method:

        [JobDisplayName("Test job ({0})")]
        public static void ExecuteJob(int p)
        {
            // Do something
        }

Gives this name in the dashboard:

Test job (System.Object[])

I'm adding the job like this:

RecurringJob.AddOrUpdate("My job name", () => ExecuteJob(12312), "* * * * *");

@pieceofsummer

This comment has been minimized.

Copy link
Contributor Author

commented Mar 26, 2018

@ernecastro see #1136. Fixed in dev branch already, will be included in the next beta.

@rfrancisco

This comment has been minimized.

Copy link

commented May 10, 2018

When can we expect the next beta with this fix?

@joshuagriffin

This comment has been minimized.

Copy link

commented Aug 1, 2018

We are waiting for this as well

@rexunderlinehxiao

This comment has been minimized.

Copy link

commented Oct 19, 2018

How about type args?

[JobDisplayName("Test job ({0})")]
public static void ExecuteJob(AnyType any)
{
// Do something
}

@Shamshiel

This comment has been minimized.

Copy link

commented Mar 26, 2019

Does this only work with static methods? I'm not able to get it to work with my non-static methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
7 participants
You can’t perform that action at this time.