Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/SourceInject/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ public void Execute(GeneratorExecutionContext context)
break;
default:
break;
}
}
foreach (var interf in ((ITypeSymbol)symbol).AllInterfaces)
{
{
if (interf.DeclaredAccessibility != Accessibility.Public &&
!SymbolEqualityComparer.Default.Equals(interf.ContainingModule, context.Compilation.SourceModule))
{
continue;
}

switch (lifetime)
{
case Lifetime.Singleton:
Expand Down
5 changes: 3 additions & 2 deletions test/ConsoleApp/ExampleService.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Lib;
using Microsoft.Extensions.DependencyInjection;

namespace ConsoleApp;

[Inject]
public class ExampleService
public class ExampleService : LibBaseService, IExampleService
{
private readonly AnotherService anotherService;

Expand All @@ -19,7 +20,7 @@ public interface IAnotherService
}

[Inject(ServiceLifetime.Singleton)]
public class AnotherService : IAnotherService
public class AnotherService : LibBaseService, IAnotherService
{
public string Value => "Hello World!";
}
Expand Down
12 changes: 12 additions & 0 deletions test/ConsoleApp/IExampleService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp
{
internal interface IExampleService
{
}
}
6 changes: 6 additions & 0 deletions test/Lib/ILibInternalInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Lib
{
internal interface ILibInternalInterface
{
}
}
12 changes: 12 additions & 0 deletions test/Lib/ILibPublicInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lib
{
public interface ILibPublicInterface
{
}
}
6 changes: 6 additions & 0 deletions test/Lib/LibBaseService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Lib
{
public class LibBaseService : ILibInternalInterface, ILibPublicInterface
{
}
}