diff --git a/src/Injectio.Generators/ServiceRegistrationWriter.cs b/src/Injectio.Generators/ServiceRegistrationWriter.cs index e2b50b6..b33eb46 100644 --- a/src/Injectio.Generators/ServiceRegistrationWriter.cs +++ b/src/Injectio.Generators/ServiceRegistrationWriter.cs @@ -203,7 +203,7 @@ private static void WriteServiceType( .IncrementIndent() .AppendLine("serviceCollection,") .Append("global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor.") - .Append(serviceRegistration.ServiceKey != null ? "DescribeKeyed" : "Describe") + .Append(serviceRegistration.ServiceKey.HasValue() ? "DescribeKeyed" : "Describe") .AppendLine("(") .IncrementIndent() .Append("typeof(") @@ -211,7 +211,7 @@ private static void WriteServiceType( .Append(serviceType) .AppendLine("),"); - if (serviceRegistration.ServiceKey != null) + if (serviceRegistration.ServiceKey.HasValue()) { codeBuilder .Append(serviceRegistration.ServiceKey)