Skip to content

Commit

Permalink
Eliminating the complex fluent interface methods for event bus.
Browse files Browse the repository at this point in the history
  • Loading branch information
daxnet committed Mar 31, 2018
1 parent 28ddfdc commit 580492f
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 982 deletions.
3 changes: 2 additions & 1 deletion CodeMaid.config
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ==================================================================================================================</value>
// ==================================================================================================================
</value>
</setting>
</SteveCadwallader.CodeMaid.Properties.Settings>
</userSettings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

namespace Apworks.Integration.AspNetCore.Configuration
{
public interface ICommandBusConfigurator : IConfigurator
{
//public interface ICommandBusConfigurator : IConfigurator
//{

}
//}

internal sealed class CommandBusConfigurator<TCommandBus> : ServiceRegisterConfigurator<ICommandBus, TCommandBus>, ICommandBusConfigurator
where TCommandBus : class, ICommandBus
{
public CommandBusConfigurator(IConfigurator context, TCommandBus implementation, ServiceLifetime serviceLifetime)
: base(context, implementation, serviceLifetime)
{
}
//internal sealed class CommandBusConfigurator<TCommandBus> : ServiceRegisterConfigurator<ICommandBus, TCommandBus>, ICommandBusConfigurator
// where TCommandBus : class, ICommandBus
//{
// public CommandBusConfigurator(IConfigurator context, TCommandBus implementation, ServiceLifetime serviceLifetime)
// : base(context, implementation, serviceLifetime)
// {
// }

public CommandBusConfigurator(IConfigurator context, Func<IServiceProvider, TCommandBus> implementationFactory, ServiceLifetime serviceLifetime)
: base(context, implementationFactory, serviceLifetime)
{
}
}
// public CommandBusConfigurator(IConfigurator context, Func<IServiceProvider, TCommandBus> implementationFactory, ServiceLifetime serviceLifetime)
// : base(context, implementationFactory, serviceLifetime)
// {
// }
//}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

namespace Apworks.Integration.AspNetCore.Configuration
{
public interface ICommandHandlerConfigurator : IConfigurator
{
//public interface ICommandHandlerConfigurator : IConfigurator
//{

}
//}

internal sealed class CommandHandlerConfigurator<TCommandHandler> : ServiceRegisterConfigurator<ICommandHandler, TCommandHandler>, ICommandHandlerConfigurator
where TCommandHandler : class, ICommandHandler
{
public CommandHandlerConfigurator(IConfigurator context, TCommandHandler implementation, ServiceLifetime serviceLifetime)
: base(context, implementation, serviceLifetime)
{
}
//internal sealed class CommandHandlerConfigurator<TCommandHandler> : ServiceRegisterConfigurator<ICommandHandler, TCommandHandler>, ICommandHandlerConfigurator
// where TCommandHandler : class, ICommandHandler
//{
// public CommandHandlerConfigurator(IConfigurator context, TCommandHandler implementation, ServiceLifetime serviceLifetime)
// : base(context, implementation, serviceLifetime)
// {
// }

public CommandHandlerConfigurator(IConfigurator context, Func<IServiceProvider, TCommandHandler> implementationFactory, ServiceLifetime serviceLifetime)
: base(context, implementationFactory, serviceLifetime)
{
}
}
// public CommandHandlerConfigurator(IConfigurator context, Func<IServiceProvider, TCommandHandler> implementationFactory, ServiceLifetime serviceLifetime)
// : base(context, implementationFactory, serviceLifetime)
// {
// }
//}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

namespace Apworks.Integration.AspNetCore.Configuration
{
public interface ICommandSenderConfigurator : IConfigurator
{
}
//public interface ICommandSenderConfigurator : IConfigurator
//{
//}

internal sealed class CommandSenderConfigurator<TCommandSender> : ServiceRegisterConfigurator<ICommandSender, TCommandSender>, ICommandSenderConfigurator
where TCommandSender : class, ICommandSender
{
public CommandSenderConfigurator(IConfigurator context, TCommandSender implementation, ServiceLifetime serviceLifetime) : base(context, implementation, serviceLifetime)
{
}
//internal sealed class CommandSenderConfigurator<TCommandSender> : ServiceRegisterConfigurator<ICommandSender, TCommandSender>, ICommandSenderConfigurator
// where TCommandSender : class, ICommandSender
//{
// public CommandSenderConfigurator(IConfigurator context, TCommandSender implementation, ServiceLifetime serviceLifetime) : base(context, implementation, serviceLifetime)
// {
// }

public CommandSenderConfigurator(IConfigurator context, Func<IServiceProvider, TCommandSender> implementationFactory, ServiceLifetime serviceLifetime) : base(context, implementationFactory, serviceLifetime)
{
}
// public CommandSenderConfigurator(IConfigurator context, Func<IServiceProvider, TCommandSender> implementationFactory, ServiceLifetime serviceLifetime) : base(context, implementationFactory, serviceLifetime)
// {
// }


}
//}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

namespace Apworks.Integration.AspNetCore.Configuration
{
public interface ICommandSubscriberConfigurator : IConfigurator
{
//public interface ICommandSubscriberConfigurator : IConfigurator
//{

}
//}

internal sealed class CommandSubscriberConfigurator<TCommandSubscriber> : ServiceRegisterConfigurator<ICommandSubscriber, TCommandSubscriber>, ICommandSubscriberConfigurator
where TCommandSubscriber : class, ICommandSubscriber
{
public CommandSubscriberConfigurator(IConfigurator context, TCommandSubscriber implementation, ServiceLifetime serviceLifetime)
: base(context, implementation, serviceLifetime)
{
}
//internal sealed class CommandSubscriberConfigurator<TCommandSubscriber> : ServiceRegisterConfigurator<ICommandSubscriber, TCommandSubscriber>, ICommandSubscriberConfigurator
// where TCommandSubscriber : class, ICommandSubscriber
//{
// public CommandSubscriberConfigurator(IConfigurator context, TCommandSubscriber implementation, ServiceLifetime serviceLifetime)
// : base(context, implementation, serviceLifetime)
// {
// }

public CommandSubscriberConfigurator(IConfigurator context, Func<IServiceProvider, TCommandSubscriber> implementationFactory, ServiceLifetime serviceLifetime)
: base(context, implementationFactory, serviceLifetime)
{
}
}
// public CommandSubscriberConfigurator(IConfigurator context, Func<IServiceProvider, TCommandSubscriber> implementationFactory, ServiceLifetime serviceLifetime)
// : base(context, implementationFactory, serviceLifetime)
// {
// }
//}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,45 @@

namespace Apworks.Integration.AspNetCore.Configuration
{
/// <summary>
/// Represents that the implemented classes are event bus configurators
/// that configure the event bus in the service collection.
/// </summary>
/// <seealso cref="Apworks.Integration.AspNetCore.Configuration.IConfigurator" />
public interface IEventBusConfigurator : IConfigurator
{
///// <summary>
///// Represents that the implemented classes are event bus configurators
///// that configure the event bus in the service collection.
///// </summary>
///// <seealso cref="Apworks.Integration.AspNetCore.Configuration.IConfigurator" />
//public interface IEventBusConfigurator : IConfigurator
//{

}
//}

/// <summary>
/// Represents the event bus configurator which configures the event bus in the service collection.
/// </summary>
/// <typeparam name="TEventBus">The type of the event bus.</typeparam>
/// <seealso cref="Apworks.Integration.AspNetCore.Configuration.ServiceRegisterConfigurator{Apworks.Events.IEventBus, TEventBus}" />
/// <seealso cref="Apworks.Integration.AspNetCore.Configuration.IEventBusConfigurator" />
internal sealed class EventBusConfigurator<TEventBus> : ServiceRegisterConfigurator<IEventBus, TEventBus>, IEventBusConfigurator
where TEventBus : class, IEventBus
{
/// <summary>
/// Initializes a new instance of the <see cref="EventBusConfigurator{TEventBus}"/> class.
/// </summary>
/// <param name="context">The configurator context.</param>
/// <param name="implementation">The implementation of the <see cref="IEventBus"/> which will be registered in the service collection.</param>
/// <param name="serviceLifetime">The service lifetime.</param>
public EventBusConfigurator(IConfigurator context, TEventBus implementation, ServiceLifetime serviceLifetime)
: base(context, implementation, serviceLifetime)
{
}
///// <summary>
///// Represents the event bus configurator which configures the event bus in the service collection.
///// </summary>
///// <typeparam name="TEventBus">The type of the event bus.</typeparam>
///// <seealso cref="Apworks.Integration.AspNetCore.Configuration.ServiceRegisterConfigurator{Apworks.Events.IEventBus, TEventBus}" />
///// <seealso cref="Apworks.Integration.AspNetCore.Configuration.IEventBusConfigurator" />
//internal sealed class EventBusConfigurator<TEventBus> : ServiceRegisterConfigurator<IEventBus, TEventBus>, IEventBusConfigurator
// where TEventBus : class, IEventBus
//{
// /// <summary>
// /// Initializes a new instance of the <see cref="EventBusConfigurator{TEventBus}"/> class.
// /// </summary>
// /// <param name="context">The configurator context.</param>
// /// <param name="implementation">The implementation of the <see cref="IEventBus"/> which will be registered in the service collection.</param>
// /// <param name="serviceLifetime">The service lifetime.</param>
// public EventBusConfigurator(IConfigurator context, TEventBus implementation, ServiceLifetime serviceLifetime)
// : base(context, implementation, serviceLifetime)
// {
// }

/// <summary>
/// Initializes a new instance of the <see cref="EventBusConfigurator{TEventBus}"/> class.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="implementationFactory">The implementation factory which creates the event bus and registers the message bus in the service collection.</param>
/// <param name="serviceLifetime">The service lifetime.</param>
public EventBusConfigurator(IConfigurator context, Func<IServiceProvider, TEventBus> implementationFactory, ServiceLifetime serviceLifetime)
: base(context, implementationFactory, serviceLifetime)
{
}
}
// /// <summary>
// /// Initializes a new instance of the <see cref="EventBusConfigurator{TEventBus}"/> class.
// /// </summary>
// /// <param name="context">The context.</param>
// /// <param name="implementationFactory">The implementation factory which creates the event bus and registers the message bus in the service collection.</param>
// /// <param name="serviceLifetime">The service lifetime.</param>
// public EventBusConfigurator(IConfigurator context, Func<IServiceProvider, TEventBus> implementationFactory, ServiceLifetime serviceLifetime)
// : base(context, implementationFactory, serviceLifetime)
// {
// }
//}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

namespace Apworks.Integration.AspNetCore.Configuration
{
public interface IEventHandlerConfigurator : IConfigurator
{
//internal interface IEventHandlerConfigurator : IConfigurator
//{

}
//}

internal sealed class EventHandlerConfigurator<TEventHandler> : ServiceRegisterConfigurator<IEventHandler, TEventHandler>, IEventHandlerConfigurator
where TEventHandler : class, IEventHandler
{
public EventHandlerConfigurator(IConfigurator context, TEventHandler implementation, ServiceLifetime serviceLifetime)
: base(context, implementation, serviceLifetime)
{
}
//internal sealed class EventHandlerConfigurator<TEventHandler> : ServiceRegisterConfigurator<IEventHandler, TEventHandler>, IEventHandlerConfigurator
// where TEventHandler : class, IEventHandler
//{
// public EventHandlerConfigurator(IConfigurator context, TEventHandler implementation, ServiceLifetime serviceLifetime)
// : base(context, implementation, serviceLifetime)
// {
// }

public EventHandlerConfigurator(IConfigurator context, Func<IServiceProvider, TEventHandler> implementationFactory, ServiceLifetime serviceLifetime)
: base(context, implementationFactory, serviceLifetime)
{
}
}
// public EventHandlerConfigurator(IConfigurator context, Func<IServiceProvider, TEventHandler> implementationFactory, ServiceLifetime serviceLifetime)
// : base(context, implementationFactory, serviceLifetime)
// {
// }
//}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

namespace Apworks.Integration.AspNetCore.Configuration
{
public interface IEventPublisherConfigurator : IConfigurator
{
}
//internal interface IEventPublisherConfigurator : IConfigurator
//{
//}

internal sealed class EventPublisherConfigurator<TEventPublisher> : ServiceRegisterConfigurator<IEventPublisher, TEventPublisher>, IEventPublisherConfigurator
where TEventPublisher : class, IEventPublisher
{
public EventPublisherConfigurator(IConfigurator context, TEventPublisher implementation, ServiceLifetime serviceLifetime) : base(context, implementation, serviceLifetime)
{
}
//internal sealed class EventPublisherConfigurator<TEventPublisher> : ServiceRegisterConfigurator<IEventPublisher, TEventPublisher>, IEventPublisherConfigurator
// where TEventPublisher : class, IEventPublisher
//{
// public EventPublisherConfigurator(IConfigurator context, TEventPublisher implementation, ServiceLifetime serviceLifetime) : base(context, implementation, serviceLifetime)
// {
// }

public EventPublisherConfigurator(IConfigurator context, Func<IServiceProvider, TEventPublisher> implementationFactory, ServiceLifetime serviceLifetime) : base(context, implementationFactory, serviceLifetime)
{
}
}
// public EventPublisherConfigurator(IConfigurator context, Func<IServiceProvider, TEventPublisher> implementationFactory, ServiceLifetime serviceLifetime) : base(context, implementationFactory, serviceLifetime)
// {
// }
//}
}
Loading

0 comments on commit 580492f

Please sign in to comment.