Skip to content

Instantly share code, notes, and snippets.

@seburgi
Last active December 26, 2015 12:29
Show Gist options
  • Save seburgi/7151225 to your computer and use it in GitHub Desktop.
Save seburgi/7151225 to your computer and use it in GitHub Desktop.
Default config for all endpoints
public class DefaultEndpointConfig : IWantToRunBeforeConfiguration
{
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public void Init()
{
SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);
Configure.With().Log4Net()
.DefiningCommandsAs(type => !type.IsAbstract && !type.IsInterface && typeof(Base.Messages.ICommand).IsAssignableFrom(type))
.DefiningEventsAs(type => !type.IsAbstract && !type.IsInterface && typeof(Base.Messages.IEvent).IsAssignableFrom(type))
.DefiningMessagesAs(type => !type.IsAbstract && !type.IsInterface && typeof(Base.Messages.IMessage).IsAssignableFrom(type));
Configure.Serialization.Json();
Configure.Features.Enable<StorageDrivenPublisher>();
Configure.Transactions.Enable();
Configure.Transactions.Advanced(settings => settings.DisableDistributedTransactions());
}
}
public interface IMessage {}
public interface ICommand : IMessage {}
public interface IEvent : IMessage {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment