public static IContainer Registers() { var builder = new ContainerBuilder(); builder.RegisterType <EmailMessage>().As <IEmailMessage>(); builder.RegisterType <LineMessage>().As <ILineMessage>(); builder.RegisterType <EmailMessage>().AsSelf(); builder.RegisterType <LineMessage>().AsSelf(); //Init Factory MessageCreator.Init(builder); return(builder.Build()); }