From 81b1c46265d5dcbf8efcd52443d287f77a72aa6f Mon Sep 17 00:00:00 2001 From: Dmitry Popov Date: Mon, 12 Aug 2019 19:32:40 +0300 Subject: [PATCH] TRunnable may be an interface --- src/RecurrentTasks/RecurrentTasks.csproj | 9 +++++---- .../RecurrentTasksServiceCollectionExtensions.cs | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/RecurrentTasks/RecurrentTasks.csproj b/src/RecurrentTasks/RecurrentTasks.csproj index 038c898..73d068c 100644 --- a/src/RecurrentTasks/RecurrentTasks.csproj +++ b/src/RecurrentTasks/RecurrentTasks.csproj @@ -1,21 +1,22 @@  - Dmitry Popov, 2016-2018 + Dmitry Popov, 2016-2019 RecurrentTasks netstandard2.0 RecurrentTasks RecurrentTasks task;job;recurrent;recurring;aspnetcore - https://github.com/justdmitry/RecurrentTasks/releases/tag/v6.0.0 + https://github.com/justdmitry/RecurrentTasks/releases/tag/v6.1.0 https://github.com/justdmitry/RecurrentTasks - https://github.com/justdmitry/RecurrentTasks/blob/master/LICENSE + git https://github.com/justdmitry/RecurrentTasks.git - 6.0.2 + 6.1.0 RecurrentTasks for .NET allows you to run simple recurrent background tasks with specific intervals, without complex frameworks, persistance, etc... just_dmitry true + MIT diff --git a/src/RecurrentTasks/RecurrentTasksServiceCollectionExtensions.cs b/src/RecurrentTasks/RecurrentTasksServiceCollectionExtensions.cs index a9264b7..27d363d 100644 --- a/src/RecurrentTasks/RecurrentTasksServiceCollectionExtensions.cs +++ b/src/RecurrentTasks/RecurrentTasksServiceCollectionExtensions.cs @@ -20,8 +20,8 @@ public static IServiceCollection AddTask( var runnableType = typeof(TRunnable); - // Register TRunnable in DI container, if not registered already - if (!services.Any(x => x.ServiceType == runnableType)) + // Register TRunnable (if not an interface or abstract class) in DI container, if not registered already + if (!runnableType.IsAbstract && !services.Any(x => x.ServiceType == runnableType)) { services.Add(new ServiceDescriptor(runnableType, runnableType, runnableLifetime)); }