/// <summary>
 /// Registers dependencies in the component.
 /// </summary>
 /// <param name="registrar">The registration system to register with, typically a DI container.</param>
 public void Register(IRegistrar registrar)
 {
     registrar.RegisterConnector(typeof(LoggingAction <,>))
     .WithConfiguration(new LoggingActionConfiguration("log trace")
     {
         LogLevel = LogLevel.Trace
     })
     .WithConfiguration(new LoggingActionConfiguration("log debug")
     {
         LogLevel = LogLevel.Debug
     })
     .WithConfiguration(new LoggingActionConfiguration("log info")
     {
         LogLevel = LogLevel.Info
     })
     .WithConfiguration(new LoggingActionConfiguration("log warn")
     {
         LogLevel = LogLevel.Warn
     })
     .WithConfiguration(new LoggingActionConfiguration("log error")
     {
         LogLevel = LogLevel.Error
     })
     .WithConfiguration(new LoggingActionConfiguration("log fatal")
     {
         LogLevel = LogLevel.Fatal
     });
 }
Exemplo n.º 2
0
 /// <summary>
 /// Registers an <see cref="IAction{TState,TInput}"/> or <see cref="IPrecondition{TState,TInput}"/>
 /// using the AssemblyQualifiedName of the <see cref="Type"/> as the Identifier and resolvable by the
 /// same value in a <see cref="Schematics.ConnectorKey"/>.
 /// </summary>
 /// <typeparam name="TConnector">
 /// The type of the connector, to use unbound generics, see the overload accepting a <see cref="Type"/> parameter.
 /// </typeparam>
 /// <param name="registrar"></param>
 /// <param name="registrationName">
 /// The name to register the type as in the <see cref="IComponentContainer"/>.
 /// <para />
 /// Registration names should ALWAYS be unique, overriding is NOT supported for safety/clarity reasons.
 /// <para />
 /// The default is the assembly qualified name of the type.
 /// </param>
 /// <remarks>
 /// Connectors are available for use by a <see cref="IStateMachine{TState,TInput}"/> when a <see cref="Schematics.ConnectorKey"/>
 /// in its <see cref="Schematics.ISchematic{TState,TInput}"/> matches a <see cref="IConnectorConfiguration"/>,
 /// that has been registered in a <see cref="IConnectorRegistration"/>'s <c>WithConfiguration</c> method.
 /// </remarks>
 public static IConnectorRegistration RegisterConnector <TConnector>(
     this IRegistrar registrar,
     string registrationName = null)
     where TConnector : IConnector
 {
     return(registrar.RegisterConnector(typeof(TConnector), registrationName));
 }
Exemplo n.º 3
0
 public static void RegisterConnector <TConnector>(
     this IRegistrar registrar,
     IConnectorConfiguration configuration,
     string registrationName = null)
     where TConnector : IConnector
 {
     registrar.RegisterConnector <TConnector>(registrationName).WithConfiguration(configuration);
 }
Exemplo n.º 4
0
 public void Register(IRegistrar registrar)
 {
     registrar.RegisterConnector <TConnector>(_connectorConfiguration ?? new ConnectorConfiguration(typeof(TConnector).AssemblyQualifiedName), _registrationName);
 }
Exemplo n.º 5
0
 public void Register(IRegistrar registrar)
 {
     registrar.RegisterConnector <TConnector>(
         _connectorConfiguration ?? new ConnectorConfiguration(TypeState.FromType(typeof(TConnector)).GetConnectorKey()), _registrationName);
 }