public StructureMapRegistry()
        {
            var config = new AFPSTConfiguration();
            //            _unsubscribeActions.Add(_bus.Subscribe<Subscriber<OrderHasBeenShippedMessage>>());
            //            _unsubscribeActions.Add(_bus.Subscribe<FaultSubscriber<OrderHasBeenShippedMessage>>());
            //            _unsubscribeActions.Add(_bus.Subscribe<Subscriber<OrderIsBackorderedMessage>>());
            //            _unsubscribeActions.Add(_bus.Subscribe<Subscriber<OrderRequestReceivedMessage>>());
            //            _unsubscribeActions.Add(_bus.Subscribe<Subscriber<InvoicedOrderMessage>>());
            //            _unsubscribeActions.Add(_bus.Subscribe<FaultSubscriber<InvoicedOrderMessage>>());
            //
            // Adding Ignore Subscriber to remove unwanted messages from queue
            //            _bus.Subscribe<IgnoreSubscriber<OrderHasBeenShippedMessage>>();
            //            _bus.Subscribe<IgnoreSubscriber<OrderRequestReceivedMessage>>();
            //            if(runOnce) Stop();

            For<INotificationSender>().Use<NotificationSender>()
                .Ctor<Queue>("notificationEndpoint").Is(config.GetQueue("EmailServiceHost", "EmailServiceEndpoint"))
                .Ctor<IEndpointCache>().Is(EndpointCacheFactory.New(ecf => ecf.AddTransportFactory<MsmqTransportFactory>()));

            For<IConsumer>().Use<WWTSubscriber<OrderRequestReceivedMessage>>();
            For<IConsumer>().Use<WWTSubscriber<OrderHasBeenShippedMessage>>();
            For<IConsumer>().Use<WWTSubscriber<InvoicedOrderMessage>>();
            For<IConsumer>().Use<Subscriber<OrderRequestReceivedMessage>>();
            For<IConsumer>().Use<Subscriber<OrderHasBeenShippedMessage>>();
            For<IConsumer>().Use<Subscriber<OrderChangeRequestReceivedMessage>>();
            For<IConsumer>().Use<Subscriber<OrderIsBackorderedMessage>>();
            For<IConsumer>().Use<Subscriber<InvoicedOrderMessage>>();
            For<IConsumer>().Use<FaultSubscriber<InvoicedOrderMessage>>();
            For<IConsumer>().Use<FaultSubscriber<OrderHasBeenShippedMessage>>();

            //For<IMessageSender<LabelPrintRequestMessage>>().Use<MessageSender<LabelPrintRequestMessage>>()
            // .Ctor<Queue>("queue").Is(config.GetQueue("reissueLabelQueueHost", "reissueLabelQueue"));
        }
        public static void Execute()
        {
            var config = new AFPSTConfiguration();

            ObjectFactory.Initialize(x =>
            {
                                             x.AddRegistry(new MassTransitContribRegistry());
                                             x.AddRegistry(new EdiDocsCommonRegistry());
                                             x.AddRegistry(new EdiDocsInRegistry());
                                             x.AddRegistry(new EdiDocsProcessingCoreRegistry(config.TestMode));
                                             x.AddRegistry(new AfpstCommonCoreRegistryWithoutDataUtilities());
                                             x.AddRegistry(new InitechEdiDocsInRegistry());
                                             x.AddRegistry(new InitechEdiDocsOutRegistry());
                                         });

            ServiceLocator.SetLocatorProvider(() => new StructureMapServiceLocator(ObjectFactory.Container));
        }
        public EdiDocsInRegistry()
        {
            var config = new AFPSTConfiguration();

            For<INotificationSender>().Use<NotificationSender>()
                .Ctor<Queue>("notificationEndpoint").Is(config.GetQueue("EmailServiceHost", "EmailServiceEndpoint"))
                .Ctor<IEndpointCache>().Is(EndpointCacheFactory.New(ecf => ecf.AddTransportFactory<MsmqTransportFactory>()));
            For<IGenericDocumentParser>().Use<GenericDocParser<OrderRequestReceivedMessage>>();
            For<IInitech850LineParser>().Use<Initech850LineParser>();
            For<ICreateEdiContentFrom<OrderRequestReceivedMessage>>().Use<Initech855Creator>();
            For<ISegmentFactory>().Use<SegmentFactory>().Named("segFactory");
            For<IControlNumberRepository>().Use<ControlNumberRepository>().Named("controlNumRepo");
            For<IAssignDocumentsToPartners>().Use<DocumentPartnerAssigner>();
            For<IBusinessPartnerSpecificServiceResolver>().Use<BusinessPartnerSpecificServiceResolver>();
            For<IFileParser>().Use<InitechFileParser>() ;
            For<IDocumentParser>().Use<Initech850Parser>();
            For<IDocumentParser>().Use<Initech997Parser>();
            For<IEdiMessagePublisher>().Use<CreateOrderMessagePublisher>();
            For<IEdiMessagePublisher>().Use<ChangeOrderMessagePublisher>();
            For<IEdiMessagePublisher>().Use<ShippedOrderMessagePublisher>();
        }
        public EdiDocsProcessingCoreRegistry(bool testMode)
        {
            IAFPSTConfiguration config = new AFPSTConfiguration();

            var connectionKey = testMode == false ? "SQLConnection" : "SQLConnectionTest";
            var createnewTables = testMode;

            For<ISessionSource>().Singleton().Use<EdiSessionSource>()
              .Ctor<string>("connectionKey").Is(connectionKey)
              .Ctor<bool>("createnewTables").Is(createnewTables);

            Scan(x =>
                     {
                         x.TheCallingAssembly();
                         x.WithDefaultConventions();
                     });

            For<IIncomingDocumentsRepository>().Use<IncomingDocumentsRepository>().Named("incomingDocsRepository");

            For<ICreateEdiDocumentFrom<InvoicedOrderMessage>>().Use<CreateEdiDocumentFrom<InvoicedOrderMessage>>();
            For<ICreateEdiDocumentFrom<InvoicedOrderMessage>>().Use<CreateEdiDocumentFrom<InvoicedOrderMessage>>();
            For<ICreateEdiDocumentFrom<OrderRequestReceivedMessage>>().Use<CreateEdiDocumentFrom<OrderRequestReceivedMessage>>();
            For<ICreateEdiDocumentFrom<OrderChangeRequestReceivedMessage>>().Use<CreateEdiDocumentFrom<OrderChangeRequestReceivedMessage>>();
            For<ICreateEdiDocumentFrom<OrderHasBeenShippedMessage>>().Use<CreateEdiDocumentFrom<OrderHasBeenShippedMessage>>();
            For<ICreateEdiDocumentFrom<OrderIsBackorderedMessage>>().Use<CreateEdiDocumentFrom<OrderIsBackorderedMessage>>();
            For<ICreateEdiDocumentFrom<FinishedAndRawInventoryCountedList>>().Use<CreateEdiDocumentFrom<FinishedAndRawInventoryCountedList>>();

            For<IBusinessPartnerResolver<OrderHasBeenShippedMessage>>().Use<BusinessPartnerResolver<OrderHasBeenShippedMessage>>().Named("856");
            For<IBusinessPartnerResolver<OrderIsBackorderedMessage>>().Use<BusinessPartnerResolver<OrderIsBackorderedMessage>>().Named("856-Backorders");
            For<IBusinessPartnerResolver<InvoicedOrderMessage>>().Use<BusinessPartnerResolver<InvoicedOrderMessage>>().Named("810");
            For<IBusinessPartnerResolver<OrderRequestReceivedMessage>>().Use<BusinessPartnerResolver<OrderRequestReceivedMessage>>().Named("855");
            For<IBusinessPartnerResolver<FinishedAndRawInventoryCountedList>>().Use<BusinessPartnerResolver<FinishedAndRawInventoryCountedList>>().Named("846");
            For<IBusinessPartnerResolver<OrderChangeRequestReceivedMessage>>().Use<BusinessPartnerResolver<OrderChangeRequestReceivedMessage>>().Named("855-Change");
            For<INotifier<OrderHasBeenShippedMessage>>().Use<ShippedOrderMessageNotifier>();
            For<INotifier<OrderIsBackorderedMessage>>().Use<BackorderedOrderMessageNotifier>();
            For<INotifier<InvoicedOrderMessage>>().Use<InvoicedOrderMessageNotifier>();
            For<INotifier<OrderRequestReceivedMessage>>().Use<OrderRequestReceivedMessageNotifier>();

            For<IPostActionSpecification>().Use<PublishEdiAsnSentSpecification>().Named(typeof(PublishEdiAsnSentSpecification).Name);
        }
        public StructureMapRegistry()
        {
            var config = new AFPSTConfiguration();

            For<IConsumer>().Use<OrderRequestReceivedMessageSubscriber>();
        }