diff --git a/laget.Quartz.Tests/laget.Quartz.Tests.csproj b/laget.Quartz.Tests/laget.Quartz.Tests.csproj index 62eaabc..3fb3853 100644 --- a/laget.Quartz.Tests/laget.Quartz.Tests.csproj +++ b/laget.Quartz.Tests/laget.Quartz.Tests.csproj @@ -9,16 +9,16 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/laget.Quartz/Utilities/Registrator.cs b/laget.Quartz/Utilities/Registrator.cs index c159f5e..f344f0e 100644 --- a/laget.Quartz/Utilities/Registrator.cs +++ b/laget.Quartz/Utilities/Registrator.cs @@ -51,7 +51,7 @@ public interface IRegistrator public class Registrator : IRegistrator { - private readonly Dictionary _bindings = new Dictionary(); + private readonly Dictionary _bindings = new Dictionary(); private readonly ContainerBuilder _builder; public Registrator(ContainerBuilder builder) @@ -65,7 +65,7 @@ public void Assembly(Assembly assembly) foreach (var job in jobs) { - _bindings.Add(job.GetHashCode(), new TypeReference(assembly, job)); + _bindings.Add(GetFullname(job), new TypeReference(assembly, job)); } } @@ -79,7 +79,7 @@ public void Register() var type = typeof(T); var assembly = type.GetTypeInfo().Assembly; - _bindings.Add(type.GetHashCode(), new TypeReference(assembly, type)); + _bindings.Add(GetFullname(type), new TypeReference(assembly, type)); } public void RegisterModule() where TModule : Module, new() @@ -109,7 +109,7 @@ private void Assembly(Assembly assembly, Type type) foreach (var job in jobs) { - _bindings.Add(job.GetHashCode(), new TypeReference(assembly, job)); + _bindings.Add(GetFullname(job), new TypeReference(assembly, job)); } } @@ -136,5 +136,13 @@ public TypeReference(Assembly assembly, Type type) public Assembly Assembly { get; } public Type Type { get; } } + + private string GetFullname(Type type) + { + if (string.IsNullOrWhiteSpace(type.FullName)) + return type.Name; + + return type.FullName; + } } }