diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index d717e1d..9d981af 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -28,5 +28,9 @@ + + + + diff --git a/src/Splat.DI.SourceGenerator.slnx b/src/Splat.DI.SourceGenerator.slnx index 2804aaa..e543ca2 100644 --- a/src/Splat.DI.SourceGenerator.slnx +++ b/src/Splat.DI.SourceGenerator.slnx @@ -21,7 +21,8 @@ - - + + + diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 7b5cb31..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.TestConcrete(), "Test1"); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 311551e..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.TestConcrete(), "Test2"); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 086f440..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.TestConcrete()); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 9bf44fa..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.Cache(), "Test1"); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index e47b996..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.Cache(), "Test2"); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index ef1b6e1..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.Cache()); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 3d8b9ee..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.Repository>(), "Test1"); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 72939b1..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.Repository>(), "Test2"); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 4aaa84e..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,19 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.Repository>()); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 7b22236..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,20 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.TestConcrete1(), "Test1"); - resolver.Register(() => new global::Test.TestConcrete2(), "Test1"); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index cb1c61a..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,20 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.TestConcrete1(), "Test2"); - resolver.Register(() => new global::Test.TestConcrete2(), "Test2"); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index 5455520..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,20 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { - resolver.Register(() => new global::Test.TestConcrete1()); - resolver.Register(() => new global::Test.TestConcrete2()); } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs deleted file mode 100644 index de8a8b3..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ /dev/null @@ -1,18 +0,0 @@ -//HintName: Splat.DI.Reg.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) - { } - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.g.verified.cs b/src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.g.verified.cs deleted file mode 100644 index 69daa86..0000000 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.g.verified.cs +++ /dev/null @@ -1,144 +0,0 @@ -//HintName: Splat.DI.g.cs -// - -#nullable enable annotations -#nullable disable warnings - -// Suppress warnings about [Obsolete] member usage in generated code. -#pragma warning disable CS0612, CS0618 - -namespace Splat -{ - /// - /// Extension methods for the Splat DI source generator. - /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] - internal static partial class SplatRegistrations - { - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - /// - /// Registers a class with its concrete class. - /// - /// The threading mode. - public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - /// The threading mode. - public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) - { - } - - /// - /// Registers a class with its concrete class. - /// - public static void Register() - { - } - - - /// - /// Registers a class with its concrete class. - /// - /// Optional contract. - public static void Register(string contract) - { - } - - /// - /// Registers a lazy class with its concrete class. - /// - public static void RegisterLazySingleton() - { - } - - - /// - /// Registers a lazy class with its concrete class. - /// - /// Optional contract. - public static void RegisterLazySingleton(string contract) - { - } - - /// - /// Proxy for the Splat SetService. - /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); - - /// - /// Proxy for the Splat SetService. - /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); - - /// - /// Registers the registrations. - /// - public static void SetupIOC() - { - SetupIOCInternal(Splat.Locator.GetLocator()); - } - - /// - /// Registers the registrations. - /// - /// The resolver to register with. - public static void SetupIOC(Splat.IDependencyResolver resolver) - { - SetupIOCInternal(resolver); - } - - - static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); - } - - /// - /// Makes the property get added by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionPropertyAttribute : System.Attribute - { - } - - /// - /// Makes this the constructor used by the DI engine. - /// - [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] - internal sealed class DependencyInjectionConstructorAttribute : System.Attribute - { - } -} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator/CodeGeneration/CodeGenerator.cs b/src/Splat.DependencyInjection.SourceGenerator/CodeGeneration/CodeGenerator.cs index a65cdbf..145d7e0 100644 --- a/src/Splat.DependencyInjection.SourceGenerator/CodeGeneration/CodeGenerator.cs +++ b/src/Splat.DependencyInjection.SourceGenerator/CodeGeneration/CodeGenerator.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for full license information. using System.Collections.Immutable; -using System.Reflection; using System.Text; using Splat.DependencyInjection.SourceGenerator.Models; @@ -15,8 +14,6 @@ namespace Splat.DependencyInjection.SourceGenerator.CodeGeneration; /// internal static class CodeGenerator { - private static readonly AssemblyName _assemblyName = typeof(Generator).Assembly.GetName(); - /// /// Generates the SetupIOCInternal method. /// @@ -29,7 +26,7 @@ internal static string GenerateSetupIOCMethod( { var sb = new StringBuilder(); - sb.Append($$""" + sb.Append(""" // #nullable enable annotations @@ -40,9 +37,18 @@ internal static string GenerateSetupIOCMethod( namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("{{_assemblyName.Name}}", "{{_assemblyName.Version}}")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { """); diff --git a/src/Splat.DependencyInjection.SourceGenerator/Constants.cs b/src/Splat.DependencyInjection.SourceGenerator/Constants.cs index 15aa374..f8c7e28 100644 --- a/src/Splat.DependencyInjection.SourceGenerator/Constants.cs +++ b/src/Splat.DependencyInjection.SourceGenerator/Constants.cs @@ -34,103 +34,138 @@ internal static class Constants namespace {{NamespaceName}} { /// - /// Extension methods for the Splat DI source generator. + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("{{_assemblyName.Name}}", "{{_assemblyName.Version}}")] internal static partial class {{ClassName}} { /// - /// Registers a class with its concrete class. + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. /// + /// The interface or base type to register. + /// The concrete type that implements . public static void Register() { } /// - /// Registers a class with its concrete class. + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. /// - /// Optional contract. + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. public static void Register(string contract) { } /// - /// Registers a class with its concrete class. + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. /// + /// The interface or base type to register. + /// The concrete type that implements . public static void RegisterLazySingleton() { } /// - /// Registers a class with its concrete class. + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. /// - /// The threading mode. + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) { } /// - /// Registers a class with its concrete class. + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. /// - /// Optional contract. + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. public static void RegisterLazySingleton(string contract) { } /// - /// Registers a class with its concrete class. + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. /// - /// Optional contract. - /// The threading mode. + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) { } /// - /// Registers a class with its concrete class. + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. /// + /// The type to register. public static void Register() { } /// - /// Registers a class with its concrete class. + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. /// - /// Optional contract. + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. public static void Register(string contract) { } /// - /// Registers a lazy class with its concrete class. + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. /// + /// The type to register. public static void RegisterLazySingleton() { } /// - /// Registers a lazy class with its concrete class. + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. /// - /// Optional contract. + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. public static void RegisterLazySingleton(string contract) { } /// - /// Proxy for the Splat SetService. + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . /// - public static void RegisterConstant(T instance) => Splat.Locator.CurrentMutable.RegisterConstant(instance); + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); /// - /// Proxy for the Splat SetService. + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . /// - /// Optional contract. - public static void RegisterConstant(T instance, string contract) => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); /// - /// Registers the registrations. + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. /// public static void SetupIOC() { @@ -138,9 +173,10 @@ public static void SetupIOC() } /// - /// Registers the registrations. + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. /// - /// The resolver to register with. + /// The instance to register dependencies with. public static void SetupIOC(Splat.IDependencyResolver resolver) { SetupIOCInternal(resolver); @@ -151,16 +187,30 @@ public static void SetupIOC(Splat.IDependencyResolver resolver) } /// - /// Makes the property get added by the DI engine. + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] internal sealed class DependencyInjectionPropertyAttribute : System.Attribute { } /// - /// Makes this the constructor used by the DI engine. + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] internal sealed class DependencyInjectionConstructorAttribute : System.Attribute { diff --git a/src/tests/Splat.DI.SourceGenerator.TestApp/ConsoleLogger.cs b/src/tests/Splat.DI.SourceGenerator.TestApp/ConsoleLogger.cs new file mode 100644 index 0000000..081df60 --- /dev/null +++ b/src/tests/Splat.DI.SourceGenerator.TestApp/ConsoleLogger.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. +// ReactiveUI Association Incorporated licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +namespace TestApp; + +/// +/// Provides a console-based implementation of . +/// +public class ConsoleLogger : ILogger +{ + /// + /// Logs a message to the console output with a [LOG] prefix. + /// + /// The message to log to the console. + public void Log(string message) => Console.WriteLine($"[LOG] {message}"); +} diff --git a/src/tests/Splat.DI.SourceGenerator.TestApp/ILogger.cs b/src/tests/Splat.DI.SourceGenerator.TestApp/ILogger.cs new file mode 100644 index 0000000..d9b6c2c --- /dev/null +++ b/src/tests/Splat.DI.SourceGenerator.TestApp/ILogger.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. +// ReactiveUI Association Incorporated licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +namespace TestApp; + +/// +/// Defines a logger contract for writing log messages. +/// +public interface ILogger +{ + /// + /// Logs a message to the output. + /// + /// The message to log. + void Log(string message); +} diff --git a/src/tests/Splat.DI.SourceGenerator.TestApp/IService.cs b/src/tests/Splat.DI.SourceGenerator.TestApp/IService.cs new file mode 100644 index 0000000..8d78a1f --- /dev/null +++ b/src/tests/Splat.DI.SourceGenerator.TestApp/IService.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. +// ReactiveUI Association Incorporated licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +namespace TestApp; + +/// +/// Defines a service contract for retrieving messages. +/// +public interface IService +{ + /// + /// Gets a message from the service. + /// + /// A string containing the service message. + string GetMessage(); +} diff --git a/src/tests/Splat.DI.SourceGenerator.TestApp/Program.cs b/src/tests/Splat.DI.SourceGenerator.TestApp/Program.cs new file mode 100644 index 0000000..9e68ec4 --- /dev/null +++ b/src/tests/Splat.DI.SourceGenerator.TestApp/Program.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. +// ReactiveUI Association Incorporated licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using Splat; + +namespace TestApp; + +/// +/// Entry point for the Splat DI Source Generator test application. +/// This application demonstrates the source generator's ability to work alongside ReactiveUI.SourceGenerators +/// without causing duplicate GeneratedCodeAttribute errors (CS0579). +/// +public static class Program +{ + /// + /// Main entry point for the application. + /// + /// Command-line arguments passed to the application. + public static void Main(string[] args) + { + // Register dependencies using source generator + SplatRegistrations.Register(); + SplatRegistrations.Register(); + SplatRegistrations.RegisterLazySingleton(); + + // Setup IOC + SplatRegistrations.SetupIOC(); + + // Test resolution + var service = Locator.Current.GetService(); + var logger = Locator.Current.GetService(); + var serviceWithDep = Locator.Current.GetService(); + + if (service != null) + { + Console.WriteLine(service.GetMessage()); + } + + if (serviceWithDep != null) + { + serviceWithDep.DoWork(); + } + + Console.WriteLine("TestApp completed successfully!"); + } +} diff --git a/src/tests/Splat.DI.SourceGenerator.TestApp/ServiceImplementation.cs b/src/tests/Splat.DI.SourceGenerator.TestApp/ServiceImplementation.cs new file mode 100644 index 0000000..20a138f --- /dev/null +++ b/src/tests/Splat.DI.SourceGenerator.TestApp/ServiceImplementation.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. +// ReactiveUI Association Incorporated licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +namespace TestApp; + +/// +/// Provides a concrete implementation of . +/// +public class ServiceImplementation : IService +{ + /// + /// Gets a greeting message from the service. + /// + /// A string containing "Hello from DI!". + public string GetMessage() => "Hello from DI!"; +} diff --git a/src/tests/Splat.DI.SourceGenerator.TestApp/ServiceWithDependency.cs b/src/tests/Splat.DI.SourceGenerator.TestApp/ServiceWithDependency.cs new file mode 100644 index 0000000..86112dd --- /dev/null +++ b/src/tests/Splat.DI.SourceGenerator.TestApp/ServiceWithDependency.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. +// ReactiveUI Association Incorporated licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +namespace TestApp; + +/// +/// A service that demonstrates constructor dependency injection. +/// +public class ServiceWithDependency +{ + private readonly ILogger _logger; + + /// + /// Initializes a new instance of the class. + /// + /// The logger instance to use for logging operations. + /// Thrown when is null. + public ServiceWithDependency(ILogger logger) + { + _logger = logger ?? throw new System.ArgumentNullException(nameof(logger)); + } + + /// + /// Performs work and logs the operation using the injected logger. + /// + public void DoWork() + { + _logger.Log("Working..."); + } +} diff --git a/src/tests/Splat.DI.SourceGenerator.TestApp/Splat.DI.SourceGenerator.TestApp.csproj b/src/tests/Splat.DI.SourceGenerator.TestApp/Splat.DI.SourceGenerator.TestApp.csproj new file mode 100644 index 0000000..c3764b3 --- /dev/null +++ b/src/tests/Splat.DI.SourceGenerator.TestApp/Splat.DI.SourceGenerator.TestApp.csproj @@ -0,0 +1,24 @@ + + + + Exe + net10.0 + enable + enable + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/AnalyzerHelpersTests.cs b/src/tests/Splat.DependencyInjection.Analyzer.Tests/AnalyzerHelpersTests.cs similarity index 100% rename from src/Splat.DependencyInjection.Analyzer.Tests/AnalyzerHelpersTests.cs rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/AnalyzerHelpersTests.cs diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/AnalyzerTestHelper.cs b/src/tests/Splat.DependencyInjection.Analyzer.Tests/AnalyzerTestHelper.cs similarity index 100% rename from src/Splat.DependencyInjection.Analyzer.Tests/AnalyzerTestHelper.cs rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/AnalyzerTestHelper.cs diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/CodeFixTestHelper.cs b/src/tests/Splat.DependencyInjection.Analyzer.Tests/CodeFixTestHelper.cs similarity index 100% rename from src/Splat.DependencyInjection.Analyzer.Tests/CodeFixTestHelper.cs rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/CodeFixTestHelper.cs diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/ConstructorAnalyzerTests.cs b/src/tests/Splat.DependencyInjection.Analyzer.Tests/ConstructorAnalyzerTests.cs similarity index 100% rename from src/Splat.DependencyInjection.Analyzer.Tests/ConstructorAnalyzerTests.cs rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/ConstructorAnalyzerTests.cs diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/ConstructorCodeFixProviderTests.cs b/src/tests/Splat.DependencyInjection.Analyzer.Tests/ConstructorCodeFixProviderTests.cs similarity index 100% rename from src/Splat.DependencyInjection.Analyzer.Tests/ConstructorCodeFixProviderTests.cs rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/ConstructorCodeFixProviderTests.cs diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/PropertyAnalyzerTests.cs b/src/tests/Splat.DependencyInjection.Analyzer.Tests/PropertyAnalyzerTests.cs similarity index 100% rename from src/Splat.DependencyInjection.Analyzer.Tests/PropertyAnalyzerTests.cs rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/PropertyAnalyzerTests.cs diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/PropertyCodeFixProviderTests.cs b/src/tests/Splat.DependencyInjection.Analyzer.Tests/PropertyCodeFixProviderTests.cs similarity index 100% rename from src/Splat.DependencyInjection.Analyzer.Tests/PropertyCodeFixProviderTests.cs rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/PropertyCodeFixProviderTests.cs diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/Splat.DependencyInjection.Analyzer.Tests.csproj b/src/tests/Splat.DependencyInjection.Analyzer.Tests/Splat.DependencyInjection.Analyzer.Tests.csproj similarity index 82% rename from src/Splat.DependencyInjection.Analyzer.Tests/Splat.DependencyInjection.Analyzer.Tests.csproj rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/Splat.DependencyInjection.Analyzer.Tests.csproj index 1191d0d..40ab772 100644 --- a/src/Splat.DependencyInjection.Analyzer.Tests/Splat.DependencyInjection.Analyzer.Tests.csproj +++ b/src/tests/Splat.DependencyInjection.Analyzer.Tests/Splat.DependencyInjection.Analyzer.Tests.csproj @@ -16,7 +16,7 @@ - + \ No newline at end of file diff --git a/src/Splat.DependencyInjection.Analyzer.Tests/TestUtilities.cs b/src/tests/Splat.DependencyInjection.Analyzer.Tests/TestUtilities.cs similarity index 100% rename from src/Splat.DependencyInjection.Analyzer.Tests/TestUtilities.cs rename to src/tests/Splat.DependencyInjection.Analyzer.Tests/TestUtilities.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/CodeGeneratorTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/CodeGeneratorTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/CodeGeneratorTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/CodeGeneratorTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/DiagnosticWarningsTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/DiagnosticWarningsTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/DiagnosticWarningsTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/DiagnosticWarningsTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/EquatableArrayTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/EquatableArrayTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/EquatableArrayTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/EquatableArrayTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/GeneratorCodeGenerationTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/GeneratorCodeGenerationTests.cs similarity index 92% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/GeneratorCodeGenerationTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/GeneratorCodeGenerationTests.cs index 94cbe10..8cdaa39 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/GeneratorCodeGenerationTests.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/GeneratorCodeGenerationTests.cs @@ -185,19 +185,18 @@ public async Task GenerateSetupIOCMethod_Empty_GeneratesCorrectStructure() } /// - /// Tests that GenerateSetupIOCMethod includes GeneratedCodeAttribute with version. + /// Tests that the extension methods file (Constants.ExtensionMethodText) includes GeneratedCodeAttribute with version. + /// This is the ONLY place where GeneratedCodeAttribute should appear on the SplatRegistrations partial class. /// /// A task representing the asynchronous test operation. [Test] - public async Task GenerateSetupIOCMethod_IncludesGeneratedCodeAttribute() + public async Task ExtensionMethodText_IncludesGeneratedCodeAttribute() { - var transients = ImmutableArray.Empty; - var lazySingletons = ImmutableArray.Empty; - - var result = CodeGenerator.GenerateSetupIOCMethod(transients, lazySingletons); + var result = Constants.ExtensionMethodText; await Assert.That(result).Contains("[global::System.CodeDom.Compiler.GeneratedCodeAttribute("); await Assert.That(result).Contains("Splat.DependencyInjection.SourceGenerator"); + await Assert.That(result).Contains("internal static partial class SplatRegistrations"); } /// @@ -311,4 +310,23 @@ public async Task GenerateLazySingletonRegistration_WithContract_GeneratesCorrec var result = sb.ToString(); await Assert.That(result).Contains(", \"MyContract\""); } + + /// + /// Tests that GenerateSetupIOCMethod does NOT include GeneratedCodeAttribute to avoid duplication. + /// The GeneratedCodeAttribute should only appear once on the partial class (in Splat.DI.g.cs), + /// not on both partial class declarations, which would cause CS0579 duplicate attribute error. + /// + /// A task representing the asynchronous test operation. + [Test] + public async Task GenerateSetupIOCMethod_DoesNotIncludeDuplicateGeneratedCodeAttribute() + { + var transients = ImmutableArray.Empty; + var lazySingletons = ImmutableArray.Empty; + + var result = CodeGenerator.GenerateSetupIOCMethod(transients, lazySingletons); + + // The GeneratedCodeAttribute should NOT be in the Splat.DI.Reg.g.cs output + // It should only be in Splat.DI.g.cs (from Constants.ExtensionMethodText) + await Assert.That(result).DoesNotContain("[global::System.CodeDom.Compiler.GeneratedCodeAttribute("); + } } diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.Reg.g.verified.cs similarity index 66% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.Reg.g.verified.cs index 90466b2..5ef6cfa 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.Reg.g.verified.cs similarity index 66% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.Reg.g.verified.cs index 5f37ba5..2782b48 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 64% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.Reg.g.verified.cs index 388156a..5e73a74 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs index fa407a3..878cfcc 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs index ffaf091..0921d88 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 68% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs index 094ee73..f1b7b92 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.Reg.g.verified.cs index 2a0a0ef..7642dcf 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.Reg.g.verified.cs index f53a27a..180d4e3 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 68% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs index 142245f..e7588e8 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntPI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs index 2a0a0ef..7642dcf 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs index f53a27a..180d4e3 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 68% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs index 142245f..e7588e8 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.Reg.g.verified.cs index 3acac0e..9c5f4fb 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_EP#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.Reg.g.verified.cs index c8b3311..e1ade15 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_N#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.Reg.g.verified.cs index f810303..cda4f55 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test1_P#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.Reg.g.verified.cs index 5295a02..37eae07 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_EP#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.Reg.g.verified.cs index 14a8231..47c75c2 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_N#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.Reg.g.verified.cs index 8b89f90..45147bf 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_Test2_P#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.Reg.g.verified.cs similarity index 74% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.Reg.g.verified.cs index a4c2b44..b76219f 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_EP#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.Reg.g.verified.cs similarity index 74% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.Reg.g.verified.cs index 9f6af3a..b1f1114 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_N#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.Reg.g.verified.cs similarity index 74% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.Reg.g.verified.cs index e6def11..fc8fae4 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPILM_contractParameter=_P#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.Reg.g.verified.cs index 57ad02c..ba369cf 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.Reg.g.verified.cs index 3513373..f67b3d4 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 74% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs index 437a651..a3a8fe8 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CMPI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPIF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.Reg.g.verified.cs index 2a0a0ef..7642dcf 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.Reg.g.verified.cs index f53a27a..180d4e3 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 68% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs index 142245f..e7588e8 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CPI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs similarity index 75% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs index f132ac4..c556b51 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs similarity index 75% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs index 45da524..7901854 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 74% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs index 63abae5..5dfaf76 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.Reg.g.verified.cs similarity index 55% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.Reg.g.verified.cs index 2fce028..681888e 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.Reg.g.verified.cs similarity index 55% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.Reg.g.verified.cs index de14154..693a587 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 55% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs index 48e7632..6916495 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.EConstructor_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.Reg.g.verified.cs similarity index 62% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.Reg.g.verified.cs index 7adfaec..8bec524 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.ServiceA(), "Test1"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.Reg.g.verified.cs similarity index 62% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.Reg.g.verified.cs index 1ac4a26..dd23f27 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.ServiceA(), "Test2"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 61% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.Reg.g.verified.cs index a5e6986..147ae98 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.ServiceA()); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IEnumerableDependencyInLSingleton_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.Reg.g.verified.cs similarity index 64% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.Reg.g.verified.cs index 7b05c3e..a9a83c7 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.Reg.g.verified.cs similarity index 64% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.Reg.g.verified.cs index e878bfb..8598d6c 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 64% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs index 2770c2d..59d2403 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.IRegMx_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.Reg.g.verified.cs similarity index 78% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.Reg.g.verified.cs index 0cf6cd2..4f4b0a3 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService>("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' with contract " + "Test1" + " not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' with contract " + "Test1" + " not registered with Splat resolver."), ServiceProperty2 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' with contract " + "Test1" + " not registered with Splat resolver."), ServiceProperty3 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' with contract " + "Test1" + " not registered with Splat resolver.") }, "Test1"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.Reg.g.verified.cs similarity index 78% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.Reg.g.verified.cs index c7d5736..eea3e84 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService>("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' with contract " + "Test2" + " not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' with contract " + "Test2" + " not registered with Splat resolver."), ServiceProperty2 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' with contract " + "Test2" + " not registered with Splat resolver."), ServiceProperty3 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' with contract " + "Test2" + " not registered with Splat resolver.") }, "Test2"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.Reg.g.verified.cs index bc09e64..5292978 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService>() ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' not registered with Splat resolver."), ServiceProperty2 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' not registered with Splat resolver."), ServiceProperty3 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' not registered with Splat resolver.") }); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.LPmRegL_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs similarity index 61% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs index 1089d51..e26f8d1 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs similarity index 61% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs index 961d876..577ef31 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 60% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs index 33b3c15..e3efca8 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs similarity index 81% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs index b72e113..0caa6f8 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs similarity index 81% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs index baa64e9..450e3d4 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 80% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs index f547788..2ad149e 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { { diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.Reg.g.verified.cs similarity index 75% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.Reg.g.verified.cs index 9bd39ac..9b136be 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.Service1(), "TestContract"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/LS.PIWithContractInLSingleton_TestContract#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/MetadataExtractorTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/MetadataExtractorTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/MetadataExtractorTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/MetadataExtractorTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/Models/ConstructorParameterTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Models/ConstructorParameterTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/Models/ConstructorParameterTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Models/ConstructorParameterTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/Models/EquatableArrayTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Models/EquatableArrayTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/Models/EquatableArrayTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Models/EquatableArrayTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/Models/PropertyInjectionTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Models/PropertyInjectionTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/Models/PropertyInjectionTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Models/PropertyInjectionTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/Models/RegistrationInfoTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Models/RegistrationInfoTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/Models/RegistrationInfoTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Models/RegistrationInfoTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/ModuleInitializer.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/ModuleInitializer.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/ModuleInitializer.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/ModuleInitializer.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.Reg.g.verified.cs similarity index 60% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.Reg.g.verified.cs index 446e16b..3750265 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test1" + " not registered with Splat resolver.")), "Test1"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.Reg.g.verified.cs similarity index 60% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.Reg.g.verified.cs index f4bf4aa..389bc7b 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test2" + " not registered with Splat resolver.")), "Test2"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 58% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.Reg.g.verified.cs index 5bd4d26..420cd0a 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' not registered with Splat resolver."))); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs similarity index 66% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs index ec3c13a..e8b0cc9 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test1" + " not registered with Splat resolver.")) { ServiceProperty = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' with contract " + "Test1" + " not registered with Splat resolver.") }, "Test1"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs similarity index 66% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs index 895ea8d..e52cf71 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test2" + " not registered with Splat resolver.")) { ServiceProperty = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' with contract " + "Test2" + " not registered with Splat resolver.") }, "Test2"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 63% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs index e91602b..dfad494 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' not registered with Splat resolver.")) { ServiceProperty = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' not registered with Splat resolver.") }); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPITypeArgument_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.Reg.g.verified.cs similarity index 65% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.Reg.g.verified.cs index 836ed98..55a34b5 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test1" + " not registered with Splat resolver.")) { ServiceProperty = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' with contract " + "Test1" + " not registered with Splat resolver.") }, "Test1"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.Reg.g.verified.cs similarity index 65% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.Reg.g.verified.cs index 405e13a..e0c1e06 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test2" + " not registered with Splat resolver.")) { ServiceProperty = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' with contract " + "Test2" + " not registered with Splat resolver.") }, "Test2"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 63% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs index a963dfb..6c3394c 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' not registered with Splat resolver.")) { ServiceProperty = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' not registered with Splat resolver.") }); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntPI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs similarity index 65% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs index 836ed98..55a34b5 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test1" + " not registered with Splat resolver.")) { ServiceProperty = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' with contract " + "Test1" + " not registered with Splat resolver.") }, "Test1"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs similarity index 65% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs index 405e13a..e0c1e06 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test2" + " not registered with Splat resolver.")) { ServiceProperty = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' with contract " + "Test2" + " not registered with Splat resolver.") }, "Test2"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 63% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs index a963dfb..6c3394c 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' not registered with Splat resolver.")) { ServiceProperty = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' not registered with Splat resolver.") }); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CIntSetPI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.Reg.g.verified.cs similarity index 73% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.Reg.g.verified.cs index 641279a..ee4d21f 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test1" + " not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' with contract " + "Test1" + " not registered with Splat resolver."), ServiceProperty2 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' with contract " + "Test1" + " not registered with Splat resolver."), ServiceProperty3 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' with contract " + "Test1" + " not registered with Splat resolver.") }, "Test1"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.Reg.g.verified.cs similarity index 73% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.Reg.g.verified.cs index 67b79b2..9f2b9d5 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test2" + " not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' with contract " + "Test2" + " not registered with Splat resolver."), ServiceProperty2 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' with contract " + "Test2" + " not registered with Splat resolver."), ServiceProperty3 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' with contract " + "Test2" + " not registered with Splat resolver.") }, "Test2"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 70% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs index 0f380ba..0df4966 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' not registered with Splat resolver."), ServiceProperty2 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' not registered with Splat resolver."), ServiceProperty3 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' not registered with Splat resolver.") }); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CMPI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPIF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CNPPSetIF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.Reg.g.verified.cs similarity index 65% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.Reg.g.verified.cs index 836ed98..55a34b5 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test1" + " not registered with Splat resolver.")) { ServiceProperty = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' with contract " + "Test1" + " not registered with Splat resolver.") }, "Test1"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.Reg.g.verified.cs similarity index 65% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.Reg.g.verified.cs index 405e13a..e0c1e06 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test2" + " not registered with Splat resolver.")) { ServiceProperty = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' with contract " + "Test2" + " not registered with Splat resolver.") }, "Test2"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 63% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs index a963dfb..6c3394c 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' not registered with Splat resolver.")) { ServiceProperty = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty' not registered with Splat resolver.") }); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CPI_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs similarity index 69% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs index 89173d6..0e6cb53 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete1(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.ITest2' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test1" + " not registered with Splat resolver.")), "Test1"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs similarity index 69% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs index 61ec3af..86dded9 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete1(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.ITest2' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test2" + " not registered with Splat resolver.")), "Test2"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 67% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs index aa13a89..f8ab7b9 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete1(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.ITest2' not registered with Splat resolver."), resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' not registered with Splat resolver."))); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.CircularDependencyF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..224eb48 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.TestConcrete(), "Test1"); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..15775a9 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.TestConcrete(), "Test2"); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..24b9674 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.TestConcrete()); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.EConstructor_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..d7527d1 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.Cache(), "Test1"); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..3973072 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.Cache(), "Test2"); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..40b7aff --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.Cache()); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_MTypePms_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..027900e --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.Repository>(), "Test1"); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..94b173b --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.Repository>(), "Test2"); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..53e83bc --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,28 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.Repository>()); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_NestedGeneric_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.Reg.g.verified.cs similarity index 57% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.Reg.g.verified.cs index 0ec88d8..d0569fd 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.AppUpdateService(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IConfig' with contract " + "Test1" + " not registered with Splat resolver.")), "Test1"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.Reg.g.verified.cs similarity index 57% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.Reg.g.verified.cs index 49e010e..fb56198 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.AppUpdateService(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IConfig' with contract " + "Test2" + " not registered with Splat resolver.")), "Test2"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 56% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.Reg.g.verified.cs index 89a818f..e1c6725 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.AppUpdateService(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IConfig' not registered with Splat resolver."))); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.GenericConcreteType_SingleTypePm_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.Reg.g.verified.cs similarity index 55% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.Reg.g.verified.cs index 94b944b..a915ee7 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetServices("Test1")), "Test1"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.Reg.g.verified.cs similarity index 55% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.Reg.g.verified.cs index 7ba6b35..238ac89 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetServices("Test2")), "Test2"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 54% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.Reg.g.verified.cs index 7419fea..e911830 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetServices())); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IEnumerableDependency_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..3b58257 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,29 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.TestConcrete1(), "Test1"); + resolver.Register(() => new global::Test.TestConcrete2(), "Test1"); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..8c6cde7 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,29 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.TestConcrete1(), "Test2"); + resolver.Register(() => new global::Test.TestConcrete2(), "Test2"); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..2f3c4c4 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,29 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { + resolver.Register(() => new global::Test.TestConcrete1()); + resolver.Register(() => new global::Test.TestConcrete2()); } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.IRegMx_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.Reg.g.verified.cs similarity index 55% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.Reg.g.verified.cs index 1fe6c72..9468877 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService>("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' with contract " + "Test1" + " not registered with Splat resolver.")), "Test1"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.Reg.g.verified.cs similarity index 55% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.Reg.g.verified.cs index 9227bf2..61b2e14 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService>("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' with contract " + "Test2" + " not registered with Splat resolver.")), "Test2"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 53% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs index 8bfad56..bc176fa 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService>() ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' not registered with Splat resolver."))); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmConstantNotRegLF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.Reg.g.verified.cs similarity index 75% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.Reg.g.verified.cs index 17dc366..0edc80f 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService>("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' with contract " + "Test1" + " not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' with contract " + "Test1" + " not registered with Splat resolver."), ServiceProperty2 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' with contract " + "Test1" + " not registered with Splat resolver."), ServiceProperty3 = resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' with contract " + "Test1" + " not registered with Splat resolver.") }, "Test1"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.Reg.g.verified.cs similarity index 75% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.Reg.g.verified.cs index ec07eef..3daa6b6 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService>("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' with contract " + "Test2" + " not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' with contract " + "Test2" + " not registered with Splat resolver."), ServiceProperty2 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' with contract " + "Test2" + " not registered with Splat resolver."), ServiceProperty3 = resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' with contract " + "Test2" + " not registered with Splat resolver.") }, "Test2"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 73% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs index cc85d94..37beb8e 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService>() ?? throw new global::System.InvalidOperationException("Dependency 'global::System.Lazy' not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' not registered with Splat resolver."), ServiceProperty2 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty2' not registered with Splat resolver."), ServiceProperty3 = resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty3' not registered with Splat resolver.") }); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.LPmNotRegLF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorNoAttrNonDIP_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs similarity index 54% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs index 56b374c..9d5a102 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver.")), "Test1"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs similarity index 54% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs index d5a75e7..2d4a008 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver.")), "Test2"); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 52% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs index 3454eb8..2e802ea 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."))); } diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithAttr_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs new file mode 100644 index 0000000..1067890 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -0,0 +1,27 @@ +//HintName: Splat.DI.Reg.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// + internal static partial class SplatRegistrations + { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) + { } + } +} \ No newline at end of file diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MConstructorWithMAttrsF_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs index 2e3580e..4405166 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete1(resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test1" + " not registered with Splat resolver."), resolver.GetService("Test1") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test1" + " not registered with Splat resolver.")), "Test1"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test1#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs similarity index 76% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs index e9a7885..ee23b8d 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete1(resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "Test2" + " not registered with Splat resolver."), resolver.GetService("Test2") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' with contract " + "Test2" + " not registered with Splat resolver.")), "Test2"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_Test2#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs similarity index 74% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs index eff5689..e03286c 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete1(resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' not registered with Splat resolver."), resolver.GetService() ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService2' not registered with Splat resolver."))); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.MultiClassesRegistrations_contractParameter=#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs similarity index 93% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs index 6161463..cdea2ad 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Microsoft.CodeAnalysis.EmbeddedAttribute.g.verified.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [System.Diagnostics.Conditional("NEVER_DEFINED")] internal sealed class EmbeddedAttribute : System.Attribute diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.Reg.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.Reg.g.verified.cs similarity index 66% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.Reg.g.verified.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.Reg.g.verified.cs index 87cdf12..c86d08a 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.Reg.g.verified.cs +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.Reg.g.verified.cs @@ -9,9 +9,18 @@ namespace Splat { - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "1.2.0.0")] + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This partial class contains the generated implementation of dependency registrations. + /// internal static partial class SplatRegistrations { + /// + /// Internal implementation of dependency injection setup. + /// This method is generated at compile-time and contains all registrations + /// defined through the source generator marker methods. + /// + /// The instance to register dependencies with. static partial void SetupIOCInternal(Splat.IDependencyResolver resolver) { resolver.Register(() => new global::Test.TestConcrete(resolver.GetService("TestContract") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IService1' with contract " + "TestContract" + " not registered with Splat resolver.")) { ServiceProperty1 = resolver.GetService("TestContract") ?? throw new global::System.InvalidOperationException("Dependency 'global::Test.IServiceProperty1' with contract " + "TestContract" + " not registered with Splat resolver.") }, "TestContract"); diff --git a/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.g.verified.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.g.verified.cs new file mode 100644 index 0000000..6423217 --- /dev/null +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/R.PIWithContract_TestContract#Splat.DI.g.verified.cs @@ -0,0 +1,194 @@ +//HintName: Splat.DI.g.cs +// + +#nullable enable annotations +#nullable disable warnings + +// Suppress warnings about [Obsolete] member usage in generated code. +#pragma warning disable CS0612, CS0618 + +namespace Splat +{ + /// + /// Provides extension methods for the Splat dependency injection source generator. + /// This class contains marker methods that are analyzed at compile-time to generate + /// dependency injection registrations. + /// + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Splat.DependencyInjection.SourceGenerator", "2.1.0.0")] + internal static partial class SplatRegistrations + { + /// + /// Registers a transient dependency mapping from to . + /// A new instance of will be created each time is resolved. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void Register() + { + } + + /// + /// Registers a transient dependency mapping from to with a contract. + /// A new instance of will be created each time is resolved with the specified contract. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + public static void RegisterLazySingleton() + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a lazy singleton dependency mapping from to with a contract and specified thread safety mode. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The interface or base type to register. + /// The concrete type that implements . + /// A unique string identifier to distinguish between multiple registrations of the same type. + /// The specifying how the singleton should be initialized in multi-threaded scenarios. + public static void RegisterLazySingleton(string contract, System.Threading.LazyThreadSafetyMode mode) + { + } + + /// + /// Registers a transient dependency for type . + /// A new instance of will be created each time it is resolved. + /// + /// The type to register. + public static void Register() + { + } + + + /// + /// Registers a transient dependency for type with a contract. + /// A new instance of will be created each time it is resolved with the specified contract. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void Register(string contract) + { + } + + /// + /// Registers a lazy singleton dependency for type . + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + public static void RegisterLazySingleton() + { + } + + + /// + /// Registers a lazy singleton dependency for type with a contract. + /// A single instance of will be created on first resolution and reused for all subsequent resolutions. + /// + /// The type to register. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterLazySingleton(string contract) + { + } + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + public static void RegisterConstant(T instance) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance); + + /// + /// Registers a constant (singleton) instance of type with the dependency resolver using a contract. + /// This method is a proxy for . + /// + /// The type of the instance to register. Must be a reference type. + /// The instance to register as a constant. + /// A unique string identifier to distinguish between multiple registrations of the same type. + public static void RegisterConstant(T instance, string contract) where T : class => Splat.Locator.CurrentMutable.RegisterConstant(instance, contract); + + /// + /// Initializes the dependency injection container by registering all dependencies with the default . + /// This method should be called once during application startup after all registration calls have been made. + /// + public static void SetupIOC() + { + SetupIOCInternal(Splat.Locator.GetLocator()); + } + + /// + /// Initializes the dependency injection container by registering all dependencies with the specified resolver. + /// This method should be called once during application startup after all registration calls have been made. + /// + /// The instance to register dependencies with. + public static void SetupIOC(Splat.IDependencyResolver resolver) + { + SetupIOCInternal(resolver); + } + + + static partial void SetupIOCInternal(Splat.IDependencyResolver resolver); + } + + /// + /// Marks a property to be injected by the dependency injection engine. + /// Properties marked with this attribute will have their values automatically + /// resolved and set by the DI container during object construction. + /// + /// + /// The property must have an accessible setter (public, internal, or internal protected). + /// The property type must be registered in the DI container, or resolution will fail at runtime. + /// + [System.AttributeUsage(System.AttributeTargets.Property), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionPropertyAttribute : System.Attribute + { + } + + /// + /// Marks a constructor as the preferred constructor for dependency injection. + /// When a class has multiple constructors, this attribute specifies which constructor + /// the DI engine should use for object construction. + /// + /// + /// Only one constructor per class should be marked with this attribute. + /// If multiple constructors exist without this attribute, the analyzer will generate + /// diagnostic warning SPLATDI001. + /// The constructor must be accessible (public, internal, or internal protected). + /// + [System.AttributeUsage(System.AttributeTargets.Constructor), Microsoft.CodeAnalysis.Embedded] + internal sealed class DependencyInjectionConstructorAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/RegisterLazySingletonTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/RegisterLazySingletonTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/RegisterLazySingletonTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/RegisterLazySingletonTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/RegisterTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/RegisterTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/RegisterTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/RegisterTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/RoslynHelpersTests.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/RoslynHelpersTests.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/RoslynHelpersTests.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/RoslynHelpersTests.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/Splat.DependencyInjection.SourceGenerator.Tests.csproj b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Splat.DependencyInjection.SourceGenerator.Tests.csproj similarity index 85% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/Splat.DependencyInjection.SourceGenerator.Tests.csproj rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Splat.DependencyInjection.SourceGenerator.Tests.csproj index c79618a..fce7e23 100644 --- a/src/Splat.DependencyInjection.SourceGenerator.Tests/Splat.DependencyInjection.SourceGenerator.Tests.csproj +++ b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/Splat.DependencyInjection.SourceGenerator.Tests.csproj @@ -19,6 +19,6 @@ - + diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/TestBase.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/TestBase.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/TestBase.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/TestBase.cs diff --git a/src/Splat.DependencyInjection.SourceGenerator.Tests/TestHelper.cs b/src/tests/Splat.DependencyInjection.SourceGenerator.Tests/TestHelper.cs similarity index 100% rename from src/Splat.DependencyInjection.SourceGenerator.Tests/TestHelper.cs rename to src/tests/Splat.DependencyInjection.SourceGenerator.Tests/TestHelper.cs