Ejemplo n.º 1
0
        //override 
        public Startup(IHostingEnvironment env)
        {
            var configFromFile = new ConfigurationBuilder()
                .AddJsonFile("appsettings.json")
                .SetBasePath(env.ContentRootPath).Build();

            var messageViewerConfiguration = new MessageViewerConfiguration();
            ConfigurationBinder.Bind(configFromFile, messageViewerConfiguration);
            Config = messageViewerConfiguration;
        }
Ejemplo n.º 2
0
        internal static void ConfigureDependencies(TinyIoCContainer container, MessageViewerConfiguration config)
        {
            var messageStore =
                new MsSqlMessageStore(
                    new MsSqlMessageStoreConfiguration("Server=.;Database=brighterMessageStore;Trusted_Connection=True",
                        "messages", MsSqlMessageStoreConfiguration.DatabaseType.MsSqlServer));

            container.Register(messageStore);
            container.Register(typeof (IMessageStoreConfigProvider), typeof (MessageStoreConfigProvider));
            container.Register(typeof (IMessageStoreViewerFactory), typeof (MessageStoreViewerFactory));
            container.Register(typeof(IHandleCommand<RepostCommand>), typeof (RepostCommandHandler));
            container.Register(typeof (IAmAMessageRecoverer), typeof (MessageRecoverer));
            container.Register<MessageViewerConfiguration>(config);

            var factory = new HandlerFactory();
            factory.Add(container.Resolve<RepostCommandHandler>());
            container.Register<IHandlerFactory>(factory);
        }
Ejemplo n.º 3
0
        internal static void ConfigureDependencies(TinyIoCContainer container, MessageViewerConfiguration config)
        {
            var messageStore =
                new MsSqlMessageStore(
                    new MsSqlMessageStoreConfiguration("Server=.;Database=brighterMessageStore;Trusted_Connection=True",
                                                       "messages", MsSqlMessageStoreConfiguration.DatabaseType.MsSqlServer));

            container.Register(messageStore);
            container.Register(typeof(IMessageStoreConfigProvider), typeof(MessageStoreConfigProvider));
            container.Register(typeof(IMessageStoreViewerFactory), typeof(MessageStoreViewerFactory));
            container.Register(typeof(IHandleCommand <RepostCommand>), typeof(RepostCommandHandler));
            container.Register(typeof(IAmAMessageRecoverer), typeof(MessageRecoverer));
            container.Register <MessageViewerConfiguration>(config);

            var factory = new HandlerFactory();

            factory.Add(container.Resolve <RepostCommandHandler>());
            container.Register <IHandlerFactory>(factory);
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            var currentDirectory = Directory.GetCurrentDirectory();

            var configFromFile = new ConfigurationBuilder()
                .AddJsonFile("appsettings.json")
                .SetBasePath(currentDirectory)
                .Build();
            var messageViewerConfiguration = new MessageViewerConfiguration();
            ConfigurationBinder.Bind(configFromFile, messageViewerConfiguration);

            var host = new WebHostBuilder()
                .UseContentRoot(currentDirectory)
                .UseStartup<Startup>()
                .UseConfiguration(configFromFile)
                .UseUrls("http://localhost:" + messageViewerConfiguration.Port)
                .UseKestrel()
                .Build();

            host.Run();
        }
        public static MessageViewerConfiguration Map(MessageViewerSection section)
        {
            var config = new MessageViewerConfiguration();
            config.Port = section.Port;
            config.Stores = new List<MessageViewerConfigurationStore>(section.Stores.Count);
            foreach (MessageViewerStoresElement store in section.Stores)
            {
                var messageViewerStoresElement = new MessageViewerConfigurationStore();
                messageViewerStoresElement.ConnectionString = store.ConnectionString;
                messageViewerStoresElement.Name = store.Name;
                messageViewerStoresElement.TableName = store.TableName; //opt
                messageViewerStoresElement.Type = store.Type;

                config.Stores.Add(messageViewerStoresElement);
            }

            config.Producer = new MessageViewerConfigurationProducer();
            config.Producer.AssemblyQualifiedName = config.Producer.AssemblyQualifiedName;

            return config;
        }
Ejemplo n.º 6
0
 public NancyBootstrapper(MessageViewerConfiguration config)
 {
     this.Config = config;
 }
 public MessageStoreConfigProvider(MessageViewerConfiguration config)
 {
     _config = config;
 }
Ejemplo n.º 8
0
 public NancyBootstrapper(MessageViewerConfiguration config)
 {
     this.Config = config;
 }
Ejemplo n.º 9
0
 public Startup(IHostingEnvironment env)
 {
     var section = MessageViewerSection.GetViewerSection;
     Config = MessageViewerSectionAdapater.Map(section);
 }
 public MessageProducerFactoryProvider(MessageViewerConfiguration config)
 {
     _producer = config.Producer;
 }