-
Notifications
You must be signed in to change notification settings - Fork 8
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
✨ [FEATURE] Added Auto Configurer #24
Conversation
private static List<Type> FindCronJobServices() | ||
{ | ||
var baseCronJobType = typeof(CronJobService); | ||
var cronJobServices = AppDomain.CurrentDomain.GetAssemblies().SelectMany(s => s.GetTypes()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend to use Assembly.GetEntryAssembly().GetReferencedAssemblies()
here.
This'll ignore 2nd level references. So, unwanted registrations can be prevented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion.
Could you give some more detailed information about the risks?
@enisn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In an example, I'm using EasyCronJob in my library and I have a couple of CronJobService, but I only register only one of them. Or I'm configuring them according to a condition, my code picks one of my CronJobService and registers it according to a condition.
If your application has that autoconfiguration and depends on my library, you'll register all of my CronJobServices in my library and all app domain assemblies too, even if I don't want to register all of them.
Summary
This PR includes added auto configurer for cron jobs.
How to use?
** Step 1
Define your cron job
** Step 2
Install
EasyCronJob.AutoConfigurer
nuget package** Step 3
Configure Cron Jobs with
Startup.cs
** NOTE **
This PR includes new feature. This feature has been requested by community members.
See #23 for more information