-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from futurum-dev/feature/source-generator
Source Generators and Analyzers and dotnet 7
- Loading branch information
Showing
94 changed files
with
3,715 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...Generator.Sample/Futurum.Microsoft.Extensions.DependencyInjection.Generator.Sample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Futurum.Microsoft.Extensions.DependencyInjection.Generator\Futurum.Microsoft.Extensions.DependencyInjection.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /> | ||
<ProjectReference Include="..\..\src\Futurum.Microsoft.Extensions.DependencyInjection\Futurum.Microsoft.Extensions.DependencyInjection.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
30 changes: 30 additions & 0 deletions
30
sample/Futurum.Microsoft.Extensions.DependencyInjection.Generator.Sample/Module.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Generator.Sample; | ||
|
||
public class InstanceModule | ||
{ | ||
[RegisterAsDependencyInjectionModule] | ||
public void Register(IServiceCollection services) | ||
{ | ||
services.TryAddTransient<IModuleService, ModuleService>(); | ||
} | ||
} | ||
|
||
public static class StaticModule | ||
{ | ||
[RegisterAsDependencyInjectionModule] | ||
public static void Register(IServiceCollection services) | ||
{ | ||
services.TryAddTransient<IModuleService, ModuleService>(); | ||
} | ||
} | ||
|
||
public interface IModuleService | ||
{ | ||
} | ||
|
||
public class ModuleService : IModuleService | ||
{ | ||
} |
97 changes: 97 additions & 0 deletions
97
sample/Futurum.Microsoft.Extensions.DependencyInjection.Generator.Sample/Registration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Generator.Sample; | ||
|
||
public interface IService1 | ||
{ | ||
} | ||
|
||
public interface IService2 | ||
{ | ||
} | ||
|
||
public interface IService3 | ||
{ | ||
} | ||
|
||
[RegisterAsTransient(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.Self)] | ||
public class TransientService_Self : IService1 | ||
{ | ||
} | ||
|
||
[RegisterAsTransient(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.ImplementedInterfaces)] | ||
public class TransientService_ImplementedInterfaces : IService1 | ||
{ | ||
} | ||
|
||
[RegisterAsTransient(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.SelfWithInterfaces)] | ||
public class TransientService_SelfWithInterfaces : IService1 | ||
{ | ||
} | ||
|
||
[RegisterAsScoped(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.Self)] | ||
public class ScopedService_Self : IService2 | ||
{ | ||
} | ||
|
||
[RegisterAsScoped(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.ImplementedInterfaces)] | ||
public class ScopedService_ImplementedInterfaces : IService2 | ||
{ | ||
} | ||
|
||
[RegisterAsScoped(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.SelfWithInterfaces)] | ||
public class ScopedService_SelfWithInterfaces : IService2 | ||
{ | ||
} | ||
|
||
[RegisterAsSingleton(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.Self)] | ||
public class SingletonService_Self : IService3 | ||
{ | ||
} | ||
|
||
[RegisterAsSingleton(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.ImplementedInterfaces)] | ||
public class SingletonService_ImplementedInterfaces : IService3 | ||
{ | ||
} | ||
|
||
[RegisterAsSingleton(InterfaceRegistrationStrategy = InterfaceRegistrationStrategy.SelfWithInterfaces)] | ||
public class SingletonService_SelfWithInterfaces : IService3 | ||
{ | ||
} | ||
|
||
[RegisterAsScoped(DuplicateRegistrationStrategy = DuplicateRegistrationStrategy.Try)] | ||
public class SingletonService_Try : IService1 | ||
{ | ||
} | ||
|
||
[RegisterAsScoped(DuplicateRegistrationStrategy = DuplicateRegistrationStrategy.Replace)] | ||
public class SingletonService_Replace : IService1 | ||
{ | ||
} | ||
|
||
[RegisterAsScoped(DuplicateRegistrationStrategy = DuplicateRegistrationStrategy.Add)] | ||
public class SingletonService_Add : IService1 | ||
{ | ||
} | ||
|
||
[RegisterAsScoped(ServiceType = typeof(IService2), DuplicateRegistrationStrategy = DuplicateRegistrationStrategy.Add)] | ||
public class ServiceMultipleInterfaces : IService1, IService2 | ||
{ | ||
} | ||
|
||
public interface IService_OpenGeneric<T> | ||
{ | ||
} | ||
|
||
[RegisterAsSingleton(ImplementationType = typeof(TransientServiceOpenGeneric<>), ServiceType = typeof(IService_OpenGeneric<>))] | ||
public class TransientServiceOpenGeneric<T> : IService_OpenGeneric<T> | ||
{ | ||
} | ||
|
||
[RegisterAsSingleton(ImplementationType = typeof(ScopedServiceOpenGeneric<>), ServiceType = typeof(IService_OpenGeneric<>))] | ||
public class ScopedServiceOpenGeneric<T> : IService_OpenGeneric<T> | ||
{ | ||
} | ||
|
||
[RegisterAsSingleton(ImplementationType = typeof(SingletonServiceOpenGeneric<>), ServiceType = typeof(IService_OpenGeneric<>))] | ||
public class SingletonServiceOpenGeneric<T> : IService_OpenGeneric<T> | ||
{ | ||
} |
17 changes: 17 additions & 0 deletions
17
sample/Futurum.Microsoft.Extensions.DependencyInjection.Generator.Sample/Startable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Generator.Sample; | ||
|
||
public class InstanceStartable | ||
{ | ||
[RegisterAsDependencyInjectionStartable] | ||
public void Register() | ||
{ | ||
} | ||
} | ||
|
||
public static class StaticStartable | ||
{ | ||
[RegisterAsDependencyInjectionStartable] | ||
public static void Register() | ||
{ | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
sample/Futurum.Microsoft.Extensions.DependencyInjection.Sample/AutomaticInstanceModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Sample; | ||
|
||
public class AutomaticInstanceModule | ||
{ | ||
[RegisterAsDependencyInjectionModule] | ||
public void Load(IServiceCollection services) | ||
{ | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
sample/Futurum.Microsoft.Extensions.DependencyInjection.Sample/AutomaticInstanceStartable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Sample; | ||
|
||
public class AutomaticInstanceStartable | ||
{ | ||
[RegisterAsDependencyInjectionStartable] | ||
public void Start() | ||
{ | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
sample/Futurum.Microsoft.Extensions.DependencyInjection.Sample/AutomaticScopedService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Sample; | ||
|
||
[RegisterAsScoped] | ||
public class AutomaticScopedService : IService | ||
{ | ||
} |
6 changes: 6 additions & 0 deletions
6
sample/Futurum.Microsoft.Extensions.DependencyInjection.Sample/AutomaticSingletonService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Sample; | ||
|
||
[RegisterAsSingleton] | ||
public class AutomaticSingletonService : IService | ||
{ | ||
} |
9 changes: 9 additions & 0 deletions
9
sample/Futurum.Microsoft.Extensions.DependencyInjection.Sample/AutomaticStaticModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Sample; | ||
|
||
public static class AutomaticStaticModule | ||
{ | ||
[RegisterAsDependencyInjectionModule] | ||
public static void Load(IServiceCollection services) | ||
{ | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
sample/Futurum.Microsoft.Extensions.DependencyInjection.Sample/AutomaticStaticStartable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Futurum.Microsoft.Extensions.DependencyInjection.Sample; | ||
|
||
public static class AutomaticStaticStartable | ||
{ | ||
[RegisterAsDependencyInjectionStartable] | ||
public static void Start() | ||
{ | ||
var x = 10; | ||
} | ||
} |
Oops, something went wrong.