public override void Apply(IDbConnection db) { db.CreateTable <UserView>(); db.ExecuteNonQuery( "INSERT INTO Users(Id, UserName, Email, FirstName, LastName, AcceptsEmails, ExperiencePoints, Level , CreatedTime, FollowingUserIds, FollowedByUserIds, NrOfProfiles, HighestAltitude, LowestAltitude)" + "SELECT Id, UserName, Email, FirstName, LastName, AcceptsEmails, ExperiencePoints, Level, CreatedTime, FollowingUserIds, FollowedByUserIds,0 , -10000, 10000" + " FROM UserView "); var view = new OrmLiteUserView(db); var eventStore = new NEventStoreDomainRepository("AltidudeConnection"); var events = eventStore.GetAllEvents(); foreach (var evt in events) { try { if (evt is ProfileCreated) { view.Handle((dynamic)evt); } } catch (RuntimeBinderException ex) { } } }
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)); }
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)); }
public override void Apply(IDbConnection db) { //db.ExecuteNonQuery("SELECT Id, UserId, Name, NrOfViews, Kudos, CreatedTime, Payload INTO ProfileBackup FROM ProfileEnvelope"); db.CreateTable <ProfileEnvelope>(false); db.ExecuteNonQuery("ALTER TABLE Profiles ALTER COLUMN Track VARCHAR(MAX)"); db.ExecuteNonQuery("ALTER TABLE Profiles ALTER COLUMN Places VARCHAR(MAX)"); var view = new OrmLiteProfileView(db); var eventStore = new NEventStoreDomainRepository("AltidudeConnection"); var events = eventStore.GetAllEvents(); foreach (var evt in events) { try { view.Handle((dynamic)evt); } catch (RuntimeBinderException ex) { } catch (Exception ex) { Log.Error(ex, "Replay event '{@evt}' in '{view}' failed", evt, view); throw; } } }