- expose addGeneratedFactory in interface

pull/62/head
Simon G. 4 days ago
parent aa18aab764
commit 8779c6883d
Signed by: SimonG
GPG Key ID: 0B82B964BA536523
  1. 7
      LightweightIocContainer/Interfaces/Registrations/Fluent/IWithFactory.cs
  2. 7
      LightweightIocContainer/Registrations/RegistrationBase.cs

@ -25,6 +25,13 @@ public interface IWithFactory
/// <typeparam name="TFactoryImplementation">The type of the implementation for the custom factory</typeparam> /// <typeparam name="TFactoryImplementation">The type of the implementation for the custom factory</typeparam>
/// <returns>The current instance of this <see cref="IRegistrationBase"/></returns> /// <returns>The current instance of this <see cref="IRegistrationBase"/></returns>
IRegistrationBase WithFactory<TFactoryInterface, TFactoryImplementation>() where TFactoryImplementation : TFactoryInterface; IRegistrationBase WithFactory<TFactoryInterface, TFactoryImplementation>() where TFactoryImplementation : TFactoryInterface;
/// <summary>
/// Internal method used by the factory source generator to add the generated factory to the registration
/// </summary>
/// <param name="generatedFactory">The actual generated factory</param>
/// <typeparam name="TFactory">The type of the generated factory</typeparam>
void AddGeneratedFactory<TFactory>(TFactory generatedFactory);
} }
internal interface IWithFactoryInternal : IWithFactory internal interface IWithFactoryInternal : IWithFactory

@ -121,7 +121,12 @@ internal abstract class RegistrationBase : IRegistrationBase, IWithFactoryIntern
return this; return this;
} }
internal void AddGeneratedFactory<TFactory>(TFactory generatedFactory) /// <summary>
/// Internal method used by the factory source generator to add the generated factory to the registration
/// </summary>
/// <param name="generatedFactory">The actual generated factory</param>
/// <typeparam name="TFactory">The type of the generated factory</typeparam>
public void AddGeneratedFactory<TFactory>(TFactory generatedFactory)
{ {
TypedFactory<TFactory> factory = new(generatedFactory); TypedFactory<TFactory> factory = new(generatedFactory);
Factory = factory; Factory = factory;

Loading…
Cancel
Save