Beispiel #1
0
        public static ApplicationInstance CreateDispatcherWebJob()
        {
            var domainRepository = new NEventStoreDomainRepository(DatabaseConnectionStringName);

            var db = OpenConnection();

            var views = new ApplicationViews(new OrmLiteUserView(db), new InMemoryUserLevelService(), new OrmLiteProfileView(db), new OrmLitePlaceRepository(db), new InMemoryChartTypeView());

            var eventHandlers = new EventHandlerContainer();

            var dateTimeProvider = new SystemDateTimeProvider();
            var userService      = new OrmLiteUserView(db);
            var placeFinder      = new OrmLitePlaceRepository(db);
            var elevationService = new GoogleMapsElevationService();

            var domainEntry = new DomainEntry(domainRepository, new ApplicationEventBus(eventHandlers), dateTimeProvider, userService, new InMemoryUserLevelService(), placeFinder, elevationService);

            var slackSendMessageUriKey = ConfigurationManager.AppSettings[SlackSendMessageUriKey];

            eventHandlers.Add(new UserProgressManager(domainEntry));
            eventHandlers.Add(new SendGridEmailNotifier(userService));
            eventHandlers.Add(new OrmLiteTrackBoundaryView(db));
            eventHandlers.Add(new SlackMessageSender(views, new Uri(slackSendMessageUriKey)));

            return(new ApplicationInstance(domainEntry, views));
        }
Beispiel #2
0
        public static ApplicationInstance BuildApplication()
        {
            var domainRepository = new NEventStoreDomainRepository(DatabaseConnectionStringName);

            var db = OpenConnection();

            var views = new ApplicationViews(new OrmLiteUserView(db), new InMemoryUserLevelService(), new OrmLiteProfileView(db), new OrmLitePlaceRepository(db), new InMemoryChartTypeView());

            var eventHandlers = new EventHandlerContainer();

            eventHandlers.Add(views.Users);
            eventHandlers.Add(views.Profiles);

            var storageConnectionString = ConfigurationManager.AppSettings[StorageConnectionStringName];

            eventHandlers.Add(new AzureBlobChartImageManager(storageConnectionString));

            var dateTimeProvider = new SystemDateTimeProvider();
            var userService      = new OrmLiteUserView(db);
            var placeFinder      = new OrmLitePlaceRepository(db);
            var elevationService = new GoogleMapsElevationService();

            var domainEntry = new DomainEntry(domainRepository, new ApplicationEventBus(eventHandlers), dateTimeProvider, userService, new InMemoryUserLevelService(), placeFinder, elevationService);

            //eventHandlers.Add(new UserProgressManager(domainEntry));
            //eventHandlers.Add(new SendGridEmailNotifier(userService));
            //eventHandlers.Add(new SlackMessageSender(new Uri("https://hooks.slack.com/services/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")));

            return(new ApplicationInstance(domainEntry, views));
        }
Beispiel #3
0
        public static DomainEntry CreateDomainEntry()
        {
            var connection       = EventStoreConnectionWrapper.Connect();
            var domainRepository = new EventStoreDomainRepository(connection);
            var domainEntry      = new DomainEntry(domainRepository);

            return(domainEntry);
        }
Beispiel #4
0
        public HttpResponseMessage Execute(TCommand command)
        {
            var connection       = Web.Configuration.CreateConnection();
            var domainRepository = new EventStoreDomainRepository(connection);
            var application      = new DomainEntry(domainRepository);

            application.ExecuteCommand(command);
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Beispiel #5
0
        public Status Post()
        {
            try
            {
                var connection       = Configuration.CreateConnection();
                var domainRepository = new EventStoreDomainRepository(connection);
                var application      = new DomainEntry(domainRepository);
                application.ExecuteCommand(Input);
            }
            catch (Exception)
            {
                return(Status.InternalServerError);
            }

            return(Status.OK);
        }
Beispiel #6
0
        public void Start()
        {
            //IServiceBus bus = ServiceBusFactory.New(cfg =>
            //{
            //    cfg.ReceiveFrom("loopback://localhost/temp");
            //});

            //InMemoryDomainRespository repo = new InMemoryDomainRespository();

            DomainRepository repo = new DomainRepository(EventDbContext.Create("EventStore"));

            DomainEntry entry = new DomainEntry(repo);

            Guid id = Guid.NewGuid();

            entry.ExecuteCommand<CreateNetworkDevice>(new CreateNetworkDevice(id, "SESM-01"));
            entry.ExecuteCommand<SetNetworkDeviceInactive>(new SetNetworkDeviceInactive(id));
            entry.ExecuteCommand<SetNetworkDeviceActive>(new SetNetworkDeviceActive(id));

            var a = 1;

            //bus.Publish(new CreateNetworkDevice(Guid.NewGuid(), "TESTAR"));
        }
 public void ProcessEvents(ICheckpointStorage checkpointStorage)
 {
     DomainEntry.ProcessEvents(checkpointStorage);
 }
 public Task ExecuteCommandAsync <TCommand>(TCommand command) where TCommand : ICommand
 {
     return(Task.Run(() => DomainEntry.ExecuteCommand(command)));
 }
 public void ExecuteCommand <TCommand>(TCommand command) where TCommand : ICommand
 {
     DomainEntry.ExecuteCommand(command);
 }
Beispiel #10
0
 public ApplicationInstance(DomainEntry domainEntry, ApplicationViews views)
 {
     DomainEntry = domainEntry;
     Views       = views;
 }
Beispiel #11
0
 public UserProgressManager(DomainEntry domainEntry)
 {
     _domainEntry = domainEntry;
 }