diff --git a/src/Pure.DI.Core/Components/Api.g.cs b/src/Pure.DI.Core/Components/Api.g.cs index 22a50dee4..f3e915917 100644 --- a/src/Pure.DI.Core/Components/Api.g.cs +++ b/src/Pure.DI.Core/Components/Api.g.cs @@ -28,20 +28,21 @@ namespace Pure.DI /// /// Binding lifetimes. - /// /// /// /// DI.Setup("Composition") /// .Bind<IDependency>().As(Lifetime.Singleton).To<Dependency>(); /// + /// See also: + ///
+ ///
+ ///
///
- /// - /// + /// internal enum Lifetime { /// /// Specifies to create a new dependency instance each time. This is the default value and can be omitted. - /// /// /// /// DI.Setup("Composition") @@ -53,56 +54,56 @@ internal enum Lifetime /// .Bind<IDependency>().To<Dependency>(); /// /// + /// Transient, /// /// Ensures that there will be a single instance of the dependency for each composition. - /// /// /// /// DI.Setup("Composition") /// .Bind<IDependency>().As(Lifetime.Singleton).To<Dependency>(); /// /// + /// Singleton, /// /// Guarantees that there will be a single instance of the dependency for each root of the composition. - /// /// /// /// DI.Setup("Composition") /// .Bind<IDependency>().As(Lifetime.PerResolve).To<Dependency>(); /// /// + /// PerResolve, /// /// Does not guarantee that there will be a single instance of the dependency for each root of the composition, but is useful to reduce the number of instances of type. - /// /// /// /// DI.Setup("Composition") /// .Bind<IDependency>().As(Lifetime.PerBlock).To<Dependency>(); /// /// + /// PerBlock, /// /// Ensures that there will be a single instance of the dependency for each scope. - /// /// /// /// DI.Setup("Composition") /// .Bind<IDependency>().As(Lifetime.Singleton).To<Dependency>(); /// /// + /// Scoped } /// /// Hints for the code generator and can be used to fine tune code generation. - /// /// /// /// // Resolve = Off @@ -115,13 +116,14 @@ internal enum Lifetime /// .Hint(Hint.Resolve, "Off") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// internal enum Hint { /// /// On or Off. Determines whether to generate Resolve methods. On by default. - /// /// /// /// // Resolve = Off @@ -135,13 +137,14 @@ internal enum Hint /// .Hint(Hint.Resolve, "Off") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// Resolve, /// /// On or Off. Determines whether to use partial OnNewInstance method. Off by default. - /// /// /// /// // OnNewInstance = On @@ -155,13 +158,14 @@ internal enum Hint /// .Hint(Hint.OnNewInstance, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnNewInstance, /// /// On or Off. Determines whether to generate partial OnNewInstance method when the _OnNewInstance_ hint is On. On by default. - /// /// /// /// // OnNewInstancePartial = On @@ -175,13 +179,14 @@ internal enum Hint /// .Hint(Hint.OnNewInstancePartial, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnNewInstancePartial, /// /// The regular expression to filter OnNewInstance by the instance type name. ".+" by default. - /// /// /// /// // OnNewInstanceImplementationTypeNameRegularExpression = Dependency @@ -195,13 +200,14 @@ internal enum Hint /// .Hint(Hint.OnNewInstanceImplementationTypeNameRegularExpression, "Dependency") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnNewInstanceImplementationTypeNameRegularExpression, /// /// The regular expression to filter OnNewInstance by the tag. ".+" by default. - /// /// /// /// // OnNewInstanceTagRegularExpression = IDependency @@ -215,13 +221,14 @@ internal enum Hint /// .Hint(Hint.OnNewInstanceTagRegularExpression, "IDependency") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnNewInstanceTagRegularExpression, /// /// The regular expression to filter OnNewInstance by the lifetime. ".+" by default. - /// /// /// /// // OnNewInstanceLifetimeRegularExpression = Singleton @@ -235,13 +242,14 @@ internal enum Hint /// .Hint(Hint.OnNewInstanceLifetimeRegularExpression, "Singleton") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnNewInstanceLifetimeRegularExpression, /// /// On or Off. Determines whether to use partial OnDependencyInjection method to control of dependency injection. Off by default. - /// /// /// /// // OnDependencyInjection = On @@ -255,13 +263,14 @@ internal enum Hint /// .Hint(Hint.OnDependencyInjection, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnDependencyInjection, /// /// On or Off. Determines whether to generate partial OnDependencyInjection method when the _OnDependencyInjection_ hint is On to control of dependency injection. On by default. - /// /// /// /// // OnDependencyInjectionPartial = On @@ -275,13 +284,14 @@ internal enum Hint /// .Hint(Hint.OnDependencyInjectionPartial, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnDependencyInjectionPartial, /// /// The regular expression to filter OnDependencyInjection by the instance type name. ".+" by default. - /// /// /// /// // OnDependencyInjectionImplementationTypeNameRegularExpression = Dependency @@ -295,13 +305,14 @@ internal enum Hint /// .Hint(Hint.OnDependencyInjectionImplementationTypeNameRegularExpression, "Dependency") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnDependencyInjectionImplementationTypeNameRegularExpression, /// /// The regular expression to filter OnDependencyInjection by the resolving type name. ".+" by default. - /// /// /// /// // OnDependencyInjectionContractTypeNameRegularExpression = IDependency @@ -315,13 +326,14 @@ internal enum Hint /// .Hint(Hint.OnDependencyInjectionContractTypeNameRegularExpression, "IDependency") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnDependencyInjectionContractTypeNameRegularExpression, /// /// The regular expression to filter OnDependencyInjection by the tag. ".+" by default. - /// /// /// /// // OnDependencyInjectionTagRegularExpression = MyTag @@ -335,13 +347,14 @@ internal enum Hint /// .Hint(Hint.OnDependencyInjectionTagRegularExpression, "MyTag") /// .Bind<IDependency>("MyTag").To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnDependencyInjectionTagRegularExpression, /// /// The regular expression to filter OnDependencyInjection by the lifetime. ".+" by default. - /// /// /// /// // OnDependencyInjectionLifetimeRegularExpression = Singleton @@ -355,13 +368,14 @@ internal enum Hint /// .Hint(Hint.OnDependencyInjectionLifetimeRegularExpression, "Singleton") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnDependencyInjectionLifetimeRegularExpression, /// /// On or Off. Determines whether to use a partial OnCannotResolve<T>(...) method to handle a scenario in which the dependency cannot be resolved. Off by default. - /// /// /// /// // OnCannotResolve = On @@ -375,13 +389,14 @@ internal enum Hint /// .Hint(Hint.OnCannotResolve, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnCannotResolve, /// /// On or Off. Determines whether to generate a partial OnCannotResolve<T>(...) method when the OnCannotResolve hint is On to handle a scenario in which the dependency cannot be resolved. On by default. - /// /// /// /// // OnCannotResolvePartial = On @@ -395,13 +410,14 @@ internal enum Hint /// .Hint(Hint.OnCannotResolvePartial, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnCannotResolvePartial, /// /// The regular expression to filter OnCannotResolve by the resolving type name. ".+" by default. - /// /// /// /// // OnCannotResolveContractTypeNameRegularExpression = OtherType @@ -415,13 +431,14 @@ internal enum Hint /// .Hint(Hint.OnCannotResolveContractTypeNameRegularExpression, "OtherType") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnCannotResolveContractTypeNameRegularExpression, /// /// The regular expression to filter OnCannotResolve by the tag. ".+" by default. - /// /// /// /// // OnCannotResolveTagRegularExpression = MyTag @@ -435,13 +452,14 @@ internal enum Hint /// .Hint(Hint.OnCannotResolveTagRegularExpression, "MyTag") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnCannotResolveTagRegularExpression, /// /// The regular expression to filter OnCannotResolve by the lifetime. ".+" by default. - /// /// /// /// // OnCannotResolveLifetimeRegularExpression = Singleton @@ -455,13 +473,14 @@ internal enum Hint /// .Hint(Hint.OnCannotResolveLifetimeRegularExpression, "Singleton") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnCannotResolveLifetimeRegularExpression, /// /// On or Off. Determines whether to use a static partial OnNewRoot<T>(...) method to handle the new Composition root registration event. Off by default. - /// /// /// /// // OnNewRoot = On @@ -475,13 +494,14 @@ internal enum Hint /// .Hint(Hint.OnNewRoot, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnNewRoot, /// /// On or Off. Determines whether to generate a static partial OnNewRoot<T>(...) method when the OnNewRoot hint is On to handle the new Composition root registration event. On by default. - /// /// /// /// // OnNewRootPartial = On @@ -495,13 +515,14 @@ internal enum Hint /// .Hint(Hint.OnNewRootPartial, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// OnNewRootPartial, /// /// On or Off. Determine if the ToString() method should be generated. This method provides a text-based class diagram in the format mermaid. Off by default. - /// /// /// /// // ToString = On @@ -515,13 +536,14 @@ internal enum Hint /// .Hint(Hint.ToString, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ToString, /// /// On or Off. This hint determines whether object Composition will be created in a thread-safe manner. On by default. - /// /// /// /// // ThreadSafe = Off @@ -535,13 +557,14 @@ internal enum Hint /// .Hint(Hint.ThreadSafe, "Off") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ThreadSafe, /// /// Overrides modifiers of the method public T Resolve<T>(). "public" by default. - /// /// /// /// // ResolveMethodModifiers = internal @@ -555,13 +578,14 @@ internal enum Hint /// .Hint(Hint.ResolveMethodModifiers, "internal") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ResolveMethodModifiers, /// /// Overrides name of the method public T Resolve<T>(). "Resolve" by default. - /// /// /// /// // ResolveMethodName = GetService @@ -575,13 +599,14 @@ internal enum Hint /// .Hint(Hint.ResolveMethodName, "GetService") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ResolveMethodName, /// /// Overrides modifiers of the method public T Resolve<T>(object? tag). "public" by default. - /// /// /// /// // ResolveByTagMethodModifiers = internal @@ -595,13 +620,14 @@ internal enum Hint /// .Hint(Hint.ResolveByTagMethodModifiers, "internal") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ResolveByTagMethodModifiers, /// /// Overrides name of the method public T Resolve<T>(object? tag). "Resolve" by default. - /// /// /// For example: /// @@ -616,13 +642,14 @@ internal enum Hint /// .Hint(Hint.ResolveByTagMethodName, "GetService") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ResolveByTagMethodName, /// /// Overrides modifiers of the method public object Resolve(Type type). "public" by default. - /// /// /// /// // ObjectResolveMethodModifiers = internal @@ -636,13 +663,14 @@ internal enum Hint /// .Hint(Hint.ObjectResolveMethodModifiers, "internal") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ObjectResolveMethodModifiers, /// /// Overrides name of the method public object Resolve(Type type). "Resolve" by default. - /// /// /// /// // ObjectResolveMethodName = GetService @@ -656,13 +684,14 @@ internal enum Hint /// .Hint(Hint.ObjectResolveMethodName, "GetService") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ObjectResolveMethodName, /// /// Overrides modifiers of the method public object Resolve(Type type, object? tag). "public" by default. - /// /// /// /// // ObjectResolveByTagMethodModifiers = internal @@ -676,13 +705,14 @@ internal enum Hint /// .Hint(Hint.ObjectResolveByTagMethodModifiers, "internal") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ObjectResolveByTagMethodModifiers, /// /// Overrides name of the method public object Resolve(Type type, object? tag). "Resolve" by default. - /// /// /// /// // ObjectResolveByTagMethodName = GetService @@ -696,13 +726,14 @@ internal enum Hint /// .Hint(Hint.ObjectResolveByTagMethodName, "GetService") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// ObjectResolveByTagMethodName, /// /// Overrides modifiers of the method public void Dispose(). "public" by default. - /// /// /// /// // DisposeMethodModifiers = internal @@ -716,14 +747,14 @@ internal enum Hint /// .Hint(Hint.DisposeMethodModifiers, "internal") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
/// - /// DisposeMethodModifiers, /// /// Overrides modifiers of the method public DisposeAsyncMethodModifiers(). "public" by default. - /// /// /// /// // DisposeAsyncMethodModifiers = internal @@ -737,14 +768,14 @@ internal enum Hint /// .Hint(Hint.DisposeAsyncMethodModifiers, "internal") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
/// - /// DisposeAsyncMethodModifiers, /// /// On or Off. Specifies whether the generated code should be formatted. This option consumes a lot of CPU resources. Off by default. - /// /// /// /// // FormatCode = On @@ -758,13 +789,14 @@ internal enum Hint /// .Hint(Hint.FormatCode, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// FormatCode, /// /// Error or Warning or Info or Hidden. Indicates the severity level of the situation when, in the binding, an implementation does not implement a contract. Error by default. - /// /// /// /// // FormatCode = On @@ -778,13 +810,14 @@ internal enum Hint /// .Hint(Hint.SeverityOfNotImplementedContracts, "On") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// SeverityOfNotImplementedContract, /// /// On or Off. Specifies whether the generated code should be commented. On by default. - /// /// /// /// // Comments = Off @@ -798,20 +831,22 @@ internal enum Hint /// .Hint(Hint.Comments, "Off") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
- /// + /// Comments } /// /// Represents a generic type argument marker. It allows you to create custom generic type argument marker such as , , etc. - /// /// /// /// [GenericTypeArgument] /// internal interface TTMy: IMy { } /// /// + /// [global::System.AttributeUsage(global::System.AttributeTargets.Class | global::System.AttributeTargets.Interface | global::System.AttributeTargets.Struct)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal sealed class GenericTypeArgumentAttribute : global::System.Attribute { } @@ -819,7 +854,6 @@ internal sealed class GenericTypeArgumentAttribute : global::System.Attribute { /// /// Represents an ordinal attribute. /// This attribute is part of the API, but you can use your own attribute at any time, and this allows you to define them in the assembly and namespace you want. - /// /// /// For constructors, it defines the sequence of attempts to use a particular constructor to create an object: /// @@ -866,9 +900,11 @@ internal sealed class GenericTypeArgumentAttribute : global::System.Attribute { /// Dependency = dependency; /// } /// + /// See also: + ///
+ ///
///
- /// - /// + /// [global::System.AttributeUsage(global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Method | global::System.AttributeTargets.Property | global::System.AttributeTargets.Field, AllowMultiple = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal class OrdinalAttribute : global::System.Attribute @@ -883,7 +919,6 @@ public OrdinalAttribute(int ordinal) { } /// /// Represents a tag attribute overriding an injection tag. The tag can be a constant, a type, or a value of an enumerated type. /// This attribute is part of the API, but you can use your own attribute at any time, and this allows you to define them in the assembly and namespace you want. - /// /// /// Sometimes it's important to take control of building a dependency graph. For example, when there are multiple implementations of the same contract. In this case, tags will help: /// @@ -930,9 +965,11 @@ public OrdinalAttribute(int ordinal) { } /// .Bind<IDependency>("Xyz").To<XyzDependency>() /// .Bind<IService>().To<Service>().Root<IService>("Root"); /// + /// See also: + ///
+ ///
///
- /// - /// + /// [global::System.AttributeUsage(global::System.AttributeTargets.Parameter | global::System.AttributeTargets.Property | global::System.AttributeTargets.Field, AllowMultiple = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal class TagAttribute : global::System.Attribute @@ -947,7 +984,6 @@ public TagAttribute(object tag) { } /// /// The injection type can be defined manually using the Type attribute.This attribute explicitly overrides an injected type, otherwise it would be determined automatically based on the type of the constructor/method, property, or field parameter. /// This attribute is part of the API, but you can use your own attribute at any time, and this allows you to define them in the assembly and namespace you want. - /// /// /// /// interface IDependency { } @@ -988,9 +1024,11 @@ public TagAttribute(object tag) { } /// DI.Setup("Composition") /// .Bind<IService>().To<Service>().Root<IService>("Root"); /// + /// See also: + ///
+ ///
///
- /// - /// + /// [global::System.AttributeUsage(global::System.AttributeTargets.Parameter | global::System.AttributeTargets.Property | global::System.AttributeTargets.Field, AllowMultiple = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal class TypeAttribute : global::System.Attribute @@ -1004,13 +1042,14 @@ public TypeAttribute(global::System.Type type) { } /// /// Determines how the partial class will be generated. The method has an additional argument kind, which defines the type of composition: - /// /// /// /// DI.Setup("BaseComposition", CompositionKind.Internal); /// + /// See also: + ///
///
- /// + /// internal enum CompositionKind { /// @@ -1031,8 +1070,9 @@ internal enum CompositionKind /// /// Determines a kind of root of the composition. + ///
See also: + ///
///
- /// [Flags] internal enum RootKinds { @@ -1085,7 +1125,6 @@ internal enum Tag /// /// Unique tag. /// Begins the definition of the binding. - /// /// /// /// DI.Setup("Composition") @@ -1094,11 +1133,11 @@ internal enum Tag /// .Root<IEnumerable<IService>>("Root"); /// /// + ///
Unique, /// /// Tag of target implementation type. - /// /// /// /// DI.Setup("Composition") @@ -1106,6 +1145,7 @@ internal enum Tag /// .Root<IService>("Root", typeof(Service)); /// /// + /// Type } @@ -1282,8 +1322,9 @@ public T Value /// /// An API for a Dependency Injection setup. + ///
See also: + ///
///
- /// internal interface IConfiguration { /// @@ -1306,33 +1347,35 @@ internal interface IConfiguration /// System.IAsyncResult /// System.AsyncCallback /// - /// /// /// /// DI.Setup("Composition") /// .Bind().To<Service>(); /// + /// See also: + ///
+ ///
///
+ /// /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins the definition of the binding. - /// /// /// /// DI.Setup("Composition") /// .Bind<IService>().To<Service>(); /// + /// See also: + ///
+ ///
///
+ /// /// The type of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// @@ -1342,8 +1385,6 @@ internal interface IConfiguration /// The type 2 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// @@ -1354,8 +1395,6 @@ internal interface IConfiguration /// The type 3 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// @@ -1367,8 +1406,6 @@ internal interface IConfiguration /// The type 4 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// @@ -1381,8 +1418,6 @@ internal interface IConfiguration /// The type 5 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// @@ -1396,8 +1431,6 @@ internal interface IConfiguration /// The type 6 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// @@ -1412,8 +1445,6 @@ internal interface IConfiguration /// The type 7 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// @@ -1429,111 +1460,115 @@ internal interface IConfiguration /// The type 8 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins the definition of the binding with applied. - /// /// /// /// DI.Setup("Composition") /// .RootBind<IService>(); /// + /// See also: + ///
+ ///
///
+ ///
/// The type of dependency to be bound. /// Specifies the unique name of the root of the composition. If the value is empty, a private root will be created, which can be used when calling Resolve methods. /// The Optional argument specifying the kind for the root of the Composition. /// The optional argument that specifies tags for a particular type of dependency binding. If is is not empty, the first tag is used for the root. /// Reference to the setup continuation chain. - /// - /// IBinding RootBind(string name = "", RootKinds kind = RootKinds.Default, params object[] tags); /// /// Indicates the use of some single or multiple setups as base setups by name. - /// /// /// /// DI.Setup("Composition") /// .DependsOn(nameof(CompositionBase)); /// + /// See also: + ///
///
+ ///
/// A set of names for the basic setups on which this one depends. /// Reference to the setup continuation chain. - /// IConfiguration DependsOn(params string[] setupNames); /// /// Specifies a custom attribute that overrides the injection type. - /// /// /// /// DI.Setup("Composition") /// .TypeAttribute<MyTypeAttribute>(); /// + /// See also: + ///
///
+ ///
/// The optional parameter that specifies the position of the type parameter in the attribute constructor. 0 by default. See predefined attribute . /// The attribute type. /// Reference to the setup continuation chain. - /// IConfiguration TypeAttribute(int typeArgumentPosition = 0) where T : global::System.Attribute; /// /// Specifies a tag attribute that overrides the injected tag. - /// /// /// /// DI.Setup("Composition") /// .TagAttribute<MyTagAttribute>(); /// + /// See also: + ///
///
+ ///
/// The optional parameter that specifies the position of the tag parameter in the attribute constructor. 0 by default. See the predefined attribute. /// The attribute type. /// Reference to the setup continuation chain. - /// IConfiguration TagAttribute(int tagArgumentPosition = 0) where T : global::System.Attribute; /// /// Specifies a custom attribute that overrides the injection ordinal. - /// /// /// /// DI.Setup("Composition") /// .OrdinalAttribute<MyOrdinalAttribute>(); /// + /// See also: + ///
///
+ ///
/// The optional parameter that specifies the position of the ordinal parameter in the attribute constructor. 0 by default. See the predefined attribute. /// The attribute type. /// Reference to the setup continuation chain. - /// IConfiguration OrdinalAttribute(int ordinalArgumentPosition = 0) where T : global::System.Attribute; /// /// Overrides the default for all bindings further down the chain. If not specified, the lifetime is used. - /// /// /// /// DI.Setup("Composition") /// .DefaultLifetime(Lifetime.Singleton); /// + /// See also: + ///
+ ///
///
+ ///
/// The default lifetime. /// Reference to the setup continuation chain. - /// - /// IConfiguration DefaultLifetime(Pure.DI.Lifetime lifetime); /// /// Adds a partial class argument and replaces the default constructor by adding this argument as a parameter. It is only created if this argument is actually used. - /// /// /// /// DI.Setup("Composition") /// .Arg<int>("id"); /// /// + ///
/// The argument name. /// The optional argument that specifies the tags for the argument. /// The argument type. @@ -1542,13 +1577,13 @@ internal interface IConfiguration /// /// Adds a root argument to use as a root parameter. - /// /// /// /// DI.Setup("Composition") /// .RootArg<int>("id"); /// /// + /// /// The argument name. /// The optional argument that specifies the tags for the argument. /// The argument type. @@ -1557,13 +1592,13 @@ internal interface IConfiguration /// /// Specifying the root of the Composition. - /// /// /// /// DI.Setup("Composition") /// .Root<Service>("MyService"); /// /// + /// /// Specifies the unique name of the root of the composition. If the value is empty, a private root will be created, which can be used when calling Resolve methods. /// Optional argument specifying the tag for the root of the Composition. /// The Composition root type. @@ -1572,34 +1607,36 @@ internal interface IConfiguration /// /// Defines a hint for fine-tuning code generation. - /// /// /// /// DI.Setup("Composition") /// .Hint(Resolve, "Off"); /// + /// See also: + ///
///
+ /// /// The hint type. /// The hint value. /// Reference to the setup continuation chain. - /// IConfiguration Hint(Hint hint, string value); /// /// Registers an accumulator for instances. - /// /// /// /// DI.Setup("Composition") /// .Accumulate<IDisposable, MyAccumulator>(Lifetime.Transient); /// + /// See also: + ///
+ ///
///
+ /// /// of the instances to be accumulated. Instances with lifetime , , or only accumulate in an accumulator that is NOT lazily created. /// The type of instance. All instances that can be cast to this type will be aacumulated. /// The type of accumulator. It must have a public constructor without parameters and a Add method with a single argument that allows you to add an instance of type . /// Reference to the setup continuation chain. - /// - /// IConfiguration Accumulate(params Lifetime[] lifetimes) where TAccumulator: new(); } @@ -1629,60 +1666,67 @@ internal interface IBinding /// System.IAsyncResult /// System.AsyncCallback /// - /// /// /// /// DI.Setup("Composition") /// .Bind().To<Service>(); /// + /// See also: + ///
+ ///
///
+ /// /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins the definition of the binding. - /// /// /// /// DI.Setup("Composition") /// .Bind<IDependency>().To<Dependency>(); /// /// + /// See also: + ///
+ ///
+ /// /// The type of dependency to be bound. Common type markers such as , and others are also supported. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins binding definition for multiple dependencies. See for examples. + ///
See also: + ///
+ ///
///
/// The type 1 of dependency to be bound. /// The type 2 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins binding definition for multiple dependencies. See for examples. + ///
See also: + ///
+ ///
///
/// The type 1 of dependency to be bound. /// The type 2 of dependency to be bound. /// The type 3 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins binding definition for multiple dependencies. See for examples. + ///
See also: + ///
+ ///
///
/// The type 1 of dependency to be bound. /// The type 2 of dependency to be bound. @@ -1690,12 +1734,13 @@ internal interface IBinding /// The type 3 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins binding definition for multiple dependencies. See for examples. + ///
See also: + ///
+ ///
///
/// The type 1 of dependency to be bound. /// The type 2 of dependency to be bound. @@ -1704,12 +1749,13 @@ internal interface IBinding /// The type 5 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins binding definition for multiple dependencies. See for examples. + ///
See also: + ///
+ ///
///
/// The type 1 of dependency to be bound. /// The type 2 of dependency to be bound. @@ -1719,12 +1765,13 @@ internal interface IBinding /// The type 6 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins binding definition for multiple dependencies. See for examples. + ///
See also: + ///
+ ///
///
/// The type 1 of dependency to be bound. /// The type 2 of dependency to be bound. @@ -1735,12 +1782,13 @@ internal interface IBinding /// The type 7 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Begins binding definition for multiple dependencies. See for examples. + ///
See also: + ///
+ ///
///
/// The type 1 of dependency to be bound. /// The type 2 of dependency to be bound. @@ -1752,28 +1800,26 @@ internal interface IBinding /// The type 8 of dependency to be bound. /// The optional argument that specifies tags for a particular type of dependency binding. /// Reference to the setup continuation chain. - /// - /// IBinding Bind(params object[] tags); /// /// Determines the of a binding. - /// /// /// /// DI.Setup("Composition") /// .Bind<IDependency>().As(Lifetime.Singleton).To<Dependency>(); /// + /// See also: + ///
+ ///
///
+ /// /// The of a binding /// Reference to the setup continuation chain. - /// - /// IBinding As(Pure.DI.Lifetime lifetime); /// /// Defines the binding tags. - /// /// /// Sometimes it's important to take control of building a dependency graph. For example, when there are multiple implementations of the same contract. In this case, tags will help: /// @@ -1820,29 +1866,31 @@ internal interface IBinding /// .Bind<IDependency>().Tags("Xyz").To<XyzDependency>() /// .Bind<IService>().To<Service>().Root<IService>("Root"); /// + /// See also: + ///
///
+ /// /// The binding tags. /// Reference to the setup continuation chain. - /// IBinding Tags(params object[] tags); /// /// Completes the binding chain by specifying the implementation. - /// /// /// /// DI.Setup("Composition") /// .Bind<IDependency>().To<Dependency>(); /// + /// See also: + ///
///
+ /// /// The implementation type. Also supports generic type markers such as , , and others. /// Reference to the setup continuation chain. - /// IConfiguration To(); /// /// Completes the binding chain by specifying the implementation using a factory method. It allows you to manually create an instance, call the necessary methods, initialize properties, fields, etc. - /// /// /// /// DI.Setup("Composition") @@ -1880,16 +1928,17 @@ internal interface IBinding /// return service; /// }) /// + /// See also: + ///
///
+ /// /// Lambda expression to manually create an instance. /// The implementation type. /// Reference to the setup continuation chain. - /// IConfiguration To(global::System.Func factory); /// /// Completes the binding chain by specifying the implementation using a source code statement. - /// /// /// /// DI.Setup("Composition") @@ -1902,11 +1951,13 @@ internal interface IBinding /// return dependency; /// }); /// + /// See also: + ///
///
+ /// /// Source code statement /// The implementation type. /// Reference to the setup continuation chain. - /// IConfiguration To(string sourceCodeStatement); } @@ -1917,7 +1968,6 @@ internal interface IContext { /// /// The tag that was used to inject the current object in the object graph. See also - /// /// /// /// DI.Setup("Composition") @@ -1928,13 +1978,14 @@ internal interface IContext /// return new Lazy<TT>(func, false); /// }; /// + /// See also: + ///
///
- /// + /// object Tag { get; } /// /// Injects an instance of type T. - /// /// /// /// DI.Setup("Composition") @@ -1960,15 +2011,16 @@ internal interface IContext /// return service; /// }) /// + /// See also: + ///
///
+ /// /// Injectable instance.. /// Instance type. - /// void Inject(out T value); /// /// Injects an instance of type T marked with a tag. - /// /// /// /// DI.Setup("Composition") @@ -1979,24 +2031,26 @@ internal interface IContext /// return new Service(dependency); /// }) /// + /// See also: + ///
///
+ /// /// The injection tag. See also . /// Injectable instance.. /// Instance type. - /// void Inject(object tag, out T value); } /// /// An API for a Dependency Injection setup. + ///
See also: + ///
///
- /// [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal static class DI { /// /// Begins the definitions of the Dependency Injection setup chain. - /// /// /// /// interface IDependency; @@ -2017,6 +2071,7 @@ internal static class DI /// .Root<IService>("Root"); /// /// + /// /// This argument specifying the partial class name to generate. /// An optional argument specifying the kind of setup. Please for details. It defaults to Public. /// Reference to the setup continuation chain. diff --git a/src/Pure.DI.Core/Core/Code/ClassCommenter.cs b/src/Pure.DI.Core/Core/Code/ClassCommenter.cs index d1d888fab..0bddb360f 100644 --- a/src/Pure.DI.Core/Core/Code/ClassCommenter.cs +++ b/src/Pure.DI.Core/Core/Code/ClassCommenter.cs @@ -26,13 +26,10 @@ public void AddComments(CompositionCode composition, Unit unit) code.AppendLine("/// "); if (classComments.Count > 0) { - code.AppendLine("/// "); foreach (var comment in comments.Format(classComments, true)) { code.AppendLine(comment); } - - code.AppendLine("/// "); } var orderedRoots = composition.Roots @@ -44,7 +41,7 @@ public void AddComments(CompositionCode composition, Unit unit) if (orderedRoots.Length > 0) { var rootComments = comments.FormatList( - "Composition roots", + "Composition roots:", orderedRoots.Select(root => (CreateRootTerms(root), CreateRootDescriptions(root))), false); @@ -112,29 +109,30 @@ IReadOnlyCollection CreateRootDescriptions(Root root) => : [ $"Provides a composition root of type {formatter.FormatRef(root.Node.Type)}." ]; } - code.AppendLine("/// "); - var root = orderedRoots.FirstOrDefault(i => i.IsPublic); if (root is not null) { code.AppendLine("/// "); - code.AppendLine($"/// This shows how to get an instance of type {formatter.FormatRef(root.Node.Type)} using the composition root {formatter.FormatRef(root)}:"); + code.AppendLine($"/// This example shows how to get an instance of type {formatter.FormatRef(root.Node.Type)} using the composition root {formatter.FormatRef(root)}:"); code.AppendLine("/// "); code.AppendLine($"/// {(composition.TotalDisposablesCount == 0 ? "" : "using ")}var composition = new {composition.Source.Source.Name.ClassName}({string.Join(", ", composition.Args.Where(i => i.Node.Arg?.Source.Kind == ArgKind.Class).Select(arg => arg.VariableDeclarationName))});"); code.AppendLine($"/// var instance = composition.{formatter.Format(root)};"); code.AppendLine("/// "); + code.AppendLine("/// See also:"); + code.AppendLine("///
"); + code.AppendLine("///
"); + code.AppendLine("///
"); code.AppendLine("///
"); } + code.AppendLine("///
"); if (!composition.Diagram.IsEmpty) { var diagramUrl = mermaidUrlBuilder.Build(composition.Diagram.Select(i => i.Text)); - code.AppendLine($"/// Class diagram
"); + code.AppendLine($"///
Class diagram
"); } - code.AppendLine("/// This class was created by Pure.DI source code generator."); - code.AppendLine("/// "); - code.AppendLine("/// "); - code.AppendLine("/// "); + code.AppendLine("///
This class was created by Pure.DI source code generator."); + code.AppendLine("/// "); } } \ No newline at end of file diff --git a/src/Pure.DI.Core/Core/Code/Comments.cs b/src/Pure.DI.Core/Core/Code/Comments.cs index 032d222fd..e6ef78d32 100644 --- a/src/Pure.DI.Core/Core/Code/Comments.cs +++ b/src/Pure.DI.Core/Core/Code/Comments.cs @@ -78,11 +78,7 @@ public IEnumerable FormatList( { yield return "/// "; yield return $"/// {title}
"; - yield return "/// "; - yield return "/// "; - yield return "/// Root"; - yield return "/// Description"; - yield return "/// "; + yield return "/// "; foreach (var (terms, descriptions) in items) { yield return "/// "; diff --git a/src/Pure.DI.Core/Core/Code/RootMethodsCommenter.cs b/src/Pure.DI.Core/Core/Code/RootMethodsCommenter.cs index 6e05d9e51..b24f8e06d 100644 --- a/src/Pure.DI.Core/Core/Code/RootMethodsCommenter.cs +++ b/src/Pure.DI.Core/Core/Code/RootMethodsCommenter.cs @@ -15,6 +15,7 @@ public void AddComments(CompositionCode composition, Root root) var rootComments = root.Source.Comments; var code = composition.Code; code.AppendLine("/// "); + code.AppendLine("/// "); if (rootComments.Count > 0) { foreach (var comment in comments.Format(rootComments, true)) @@ -26,19 +27,20 @@ public void AddComments(CompositionCode composition, Root root) { code.AppendLine($"/// Provides a composition root of type {formatter.FormatRef(root.Node.Type)}."); } - - code.AppendLine("/// "); + + code.AppendLine("///
"); if (!root.IsPublic) { return; } code.AppendLine("/// "); - code.AppendLine($"/// This shows how to get an instance of type {formatter.FormatRef(root.Node.Type)}:"); + code.AppendLine($"/// This example shows how to get an instance of type {formatter.FormatRef(root.Node.Type)}:"); code.AppendLine("/// "); code.AppendLine($"/// {(composition.TotalDisposablesCount == 0 ? "" : "using ")}var composition = new {composition.Source.Source.Name.ClassName}({string.Join(", ", composition.Args.Where(i => i.Node.Arg?.Source.Kind == ArgKind.Class).Select(arg => arg.VariableDeclarationName))});"); code.AppendLine($"/// var instance = composition.{formatter.Format(root)};"); code.AppendLine("/// "); code.AppendLine("/// "); + code.AppendLine("/// "); } } \ No newline at end of file