public AppDomainObjectTests() { A.CallTo(() => user.Id) .Returns(contributorId); A.CallTo(() => userResolver.FindByIdOrEmailAsync(contributorId)) .Returns(user); A.CallTo(() => appPlansProvider.GetFreePlan()) .Returns(new ConfigAppLimitsPlan { Id = planIdFree, MaxContributors = 10 }); A.CallTo(() => appPlansProvider.GetPlan(planIdFree)) .Returns(new ConfigAppLimitsPlan { Id = planIdFree, MaxContributors = 10 }); A.CallTo(() => appPlansProvider.GetPlan(planIdPaid)) .Returns(new ConfigAppLimitsPlan { Id = planIdPaid, MaxContributors = 30 }); initialPatterns = new InitialPatterns { { patternId1, new AppPattern("Number", "[0-9]") }, { patternId2, new AppPattern("Numbers", "[0-9]*") } }; sut = new AppDomainObject(Store, A.Dummy <ISemanticLog>(), initialPatterns, appPlansProvider, appPlansBillingManager, userResolver); sut.Setup(Id); }
public static void AddSquidexApps(this IServiceCollection services) { services.AddSingletonAs <RolePermissionsProvider>() .AsSelf(); services.AddSingletonAs <AppHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <AppProvider>() .As <IAppProvider>(); services.AddSingletonAs <AppUISettings>() .As <IAppUISettings>(); services.AddSingleton(c => { var uiOptions = c.GetRequiredService <IOptions <MyUIOptions> >().Value; var result = new InitialPatterns(); if (uiOptions.RegexSuggestions != null) { foreach (var(key, value) in uiOptions.RegexSuggestions) { if (!string.IsNullOrWhiteSpace(key) && !string.IsNullOrWhiteSpace(value)) { result[Guid.NewGuid()] = new AppPattern(key, value); } } } return(result); }); }
public MainWindow() { InitializeComponent(); Width = CellSize * (BoardHeight + 2); Height = CellSize * (BoardWidth + 5); var stackPanel = new StackPanel(); Content = stackPanel; drawingVisualElement = new DrawingVisualElement(); stackPanel.Children.Add(drawingVisualElement); var drawingContext = drawingVisualElement.drawingVisual.RenderOpen(); Board = new Board(BoardHeight, BoardWidth, InitialPatterns.HelloWorld()); bTimer = aTimer = new System.Timers.Timer(); bTimer.Interval = Delay; // Hook up the Elapsed event for the timer. bTimer.Elapsed += (sender, e) => bTimerCall(); // Have the timer fire repeated events (true is the default) bTimer.AutoReset = true; // Start the timer bTimer.Enabled = true; loadGrid(); }
public Migration02_AddPatterns( InitialPatterns initialPatterns, IStateFactory stateFactory, IAppRepository appRepository) { this.initialPatterns = initialPatterns; this.appRepository = appRepository; this.stateFactory = stateFactory; }
public AppDomainObject(IPersistenceFactory <State> persistence, ISemanticLog log, InitialPatterns initialPatterns, IAppPlansProvider appPlansProvider, IAppPlanBillingManager appPlansBillingManager, IUserResolver userResolver) : base(persistence, log) { Guard.NotNull(initialPatterns, nameof(initialPatterns)); Guard.NotNull(userResolver, nameof(userResolver)); Guard.NotNull(appPlansProvider, nameof(appPlansProvider)); Guard.NotNull(appPlansBillingManager, nameof(appPlansBillingManager)); this.userResolver = userResolver; this.appPlansProvider = appPlansProvider; this.appPlansBillingManager = appPlansBillingManager; this.initialPatterns = initialPatterns; }
public AppDomainObject(IStore <DomainId> store, ISemanticLog log, InitialPatterns initialPatterns, IAppPlansProvider appPlansProvider, IAppPlanBillingManager appPlansBillingManager, IUserResolver userResolver) : base(store, log) { Guard.NotNull(initialPatterns, nameof(initialPatterns)); Guard.NotNull(userResolver, nameof(userResolver)); Guard.NotNull(appPlansProvider, nameof(appPlansProvider)); Guard.NotNull(appPlansBillingManager, nameof(appPlansBillingManager)); this.userResolver = userResolver; this.appPlansProvider = appPlansProvider; this.appPlansBillingManager = appPlansBillingManager; this.initialPatterns = initialPatterns; }
public AddPatterns(InitialPatterns initialPatterns, ICommandBus commandBus, IAppsIndex indexForApps) { this.indexForApps = indexForApps; this.initialPatterns = initialPatterns; this.commandBus = commandBus; }
public static void AddMyEntitiesServices(this IServiceCollection services, IConfiguration config) { var exposeSourceUrl = config.GetOptionalValue("assetStore:exposeSourceUrl", true); services.AddSingletonAs(c => new UrlGenerator( c.GetRequiredService <IOptions <UrlsOptions> >(), c.GetRequiredService <IAssetStore>(), exposeSourceUrl)) .As <IGraphQLUrlGenerator>().As <IRuleUrlGenerator>().As <IAssetUrlGenerator>(); services.AddSingletonAs <HistoryService>() .As <IEventConsumer>().As <IHistoryService>(); services.AddSingletonAs <AssetUsageTracker>() .As <IEventConsumer>().As <IAssetUsageTracker>(); services.AddSingletonAs <CachingGraphQLService>() .As <IGraphQLService>(); services.AddSingletonAs <TempFolderBackupArchiveLocation>() .As <IBackupArchiveLocation>(); services.AddSingletonAs <AppProvider>() .As <IAppProvider>(); services.AddSingletonAs <AssetQueryService>() .As <IAssetQueryService>(); services.AddSingletonAs <ContentQueryService>() .As <IContentQueryService>(); services.AddSingletonAs <ContentVersionLoader>() .As <IContentVersionLoader>(); services.AddSingletonAs <AppHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <ContentHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <SchemaHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <RolePermissionsProvider>() .AsSelf(); services.AddSingletonAs <EdmModelBuilder>() .AsSelf(); services.AddSingletonAs <GrainTagService>() .As <ITagService>(); services.AddSingletonAs <GrainTextIndexer>() .As <ITextIndexer>().As <IEventConsumer>(); services.AddSingletonAs <FileTypeTagGenerator>() .As <ITagGenerator <CreateAsset> >(); services.AddSingletonAs <ImageTagGenerator>() .As <ITagGenerator <CreateAsset> >(); services.AddSingletonAs <JintScriptEngine>() .AsOptional <IScriptEngine>(); services.AddSingletonAs <GrainBootstrap <IContentSchedulerGrain> >() .AsSelf(); services.AddSingletonAs <GrainBootstrap <IRuleDequeuerGrain> >() .AsSelf(); services.AddCommandPipeline(); services.AddBackupHandlers(); services.AddSingleton <Func <IGrainCallContext, string> >(DomainObjectGrainFormatter.Format); services.AddSingleton(c => { var uiOptions = c.GetRequiredService <IOptions <MyUIOptions> >(); var result = new InitialPatterns(); foreach (var pattern in uiOptions.Value.RegexSuggestions) { if (!string.IsNullOrWhiteSpace(pattern.Key) && !string.IsNullOrWhiteSpace(pattern.Value)) { result[Guid.NewGuid()] = new AppPattern(pattern.Key, pattern.Value); } } return(result); }); }
public static void AddMyEntitiesServices(this IServiceCollection services, IConfiguration config) { var exposeSourceUrl = config.GetOptionalValue("assetStore:exposeSourceUrl", true); services.AddSingletonAs(c => new UrlGenerator( c.GetRequiredService <IOptions <UrlsOptions> >(), c.GetRequiredService <IAssetStore>(), exposeSourceUrl)) .As <IGraphQLUrlGenerator>().As <IRuleUrlGenerator>().As <IAssetUrlGenerator>().As <IEmailUrlGenerator>(); services.AddSingletonAs <HistoryService>() .As <IEventConsumer>().As <IHistoryService>(); services.AddSingletonAs <AssetUsageTracker>() .As <IEventConsumer>().As <IAssetUsageTracker>(); services.AddSingletonAs(x => new FuncDependencyResolver(t => x.GetRequiredService(t))) .As <IDependencyResolver>(); services.AddSingletonAs <DataLoaderContextAccessor>() .As <IDataLoaderContextAccessor>(); services.AddSingletonAs <DataLoaderDocumentListener>() .AsSelf(); services.AddSingletonAs <CachingGraphQLService>() .As <IGraphQLService>(); services.AddSingletonAs <CachingGraphQLService>() .As <IGraphQLService>(); services.AddSingletonAs <TempFolderBackupArchiveLocation>() .As <IBackupArchiveLocation>(); services.AddSingletonAs <AppProvider>() .As <IAppProvider>(); services.AddSingletonAs <AssetEnricher>() .As <IAssetEnricher>(); services.AddSingletonAs <AssetQueryService>() .As <IAssetQueryService>(); services.AddSingletonAs <ContentEnricher>() .As <IContentEnricher>(); services.AddSingletonAs <ContentQueryService>() .As <IContentQueryService>(); services.AddSingletonAs <ContentVersionLoader>() .As <IContentVersionLoader>(); services.AddSingletonAs <AppHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <ContentHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <SchemaHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <DefaultContentWorkflow>() .AsOptional <IContentWorkflow>(); services.AddSingletonAs <RolePermissionsProvider>() .AsSelf(); services.AddSingletonAs <EdmModelBuilder>() .AsSelf(); services.AddSingletonAs <GrainTagService>() .As <ITagService>(); services.AddSingletonAs <GrainTextIndexer>() .As <ITextIndexer>().As <IEventConsumer>(); services.AddSingletonAs <FileTypeTagGenerator>() .As <ITagGenerator <CreateAsset> >(); services.AddSingletonAs <ImageTagGenerator>() .As <ITagGenerator <CreateAsset> >(); services.AddSingletonAs <JintScriptEngine>() .AsOptional <IScriptEngine>(); services.AddSingletonAs <GrainBootstrap <IContentSchedulerGrain> >() .AsSelf(); services.AddSingletonAs <GrainBootstrap <IRuleDequeuerGrain> >() .AsSelf(); services.AddCommandPipeline(); services.AddBackupHandlers(); services.AddSingleton <Func <IGrainCallContext, string> >(DomainObjectGrainFormatter.Format); services.AddSingleton(c => { var uiOptions = c.GetRequiredService <IOptions <MyUIOptions> >(); var result = new InitialPatterns(); foreach (var pattern in uiOptions.Value.RegexSuggestions) { if (!string.IsNullOrWhiteSpace(pattern.Key) && !string.IsNullOrWhiteSpace(pattern.Value)) { result[Guid.NewGuid()] = new AppPattern(pattern.Key, pattern.Value); } } return(result); }); var emailOptions = config.GetSection("email:smtp").Get <SmptOptions>(); if (emailOptions.IsConfigured()) { services.AddSingleton(Options.Create(emailOptions)); services.Configure <NotificationEmailTextOptions>( config.GetSection("email:notifications")); services.AddSingletonAs <SmtpEmailSender>() .As <IEmailSender>(); services.AddSingletonAs <NotificationEmailSender>() .AsOptional <INotificationEmailSender>(); } else { services.AddSingletonAs <NoopNotificationEmailSender>() .AsOptional <INotificationEmailSender>(); } services.AddSingletonAs <NotificationEmailEventConsumer>() .As <IEventConsumer>(); }
public AddPatterns(InitialPatterns initialPatterns, IGrainFactory grainFactory) { this.initialPatterns = initialPatterns; this.grainFactory = grainFactory; }
public static void AddMyEntitiesServices(this IServiceCollection services, IConfiguration config) { var exposeSourceUrl = config.GetOptionalValue("assetStore:exposeSourceUrl", true); services.AddSingletonAs(c => new UrlGenerator( c.GetRequiredService <IOptions <MyUrlsOptions> >(), c.GetRequiredService <IAssetStore>(), exposeSourceUrl)) .As <IGraphQLUrlGenerator>() .As <IRuleUrlGenerator>(); services.AddSingletonAs <CachingGraphQLService>() .As <IGraphQLService>(); services.AddSingletonAs <TempFolderBackupArchiveLocation>() .As <IBackupArchiveLocation>(); services.AddSingletonAs <AppProvider>() .As <IAppProvider>(); services.AddSingletonAs <ContentQueryService>() .As <IContentQueryService>(); services.AddSingletonAs <ContentVersionLoader>() .As <IContentVersionLoader>(); services.AddSingletonAs <AppHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <ContentHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <SchemaHistoryEventsCreator>() .As <IHistoryEventsCreator>(); services.AddSingletonAs <EdmModelBuilder>() .AsSelf(); services.AddSingletonAs <InMemoryCommandBus>() .As <ICommandBus>(); services.AddSingletonAs <ETagCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <EnrichWithTimestampCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <EnrichWithActorCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <EnrichWithAppIdCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <EnrichWithSchemaIdCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <AssetCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <GrainCommandMiddleware <AppCommand, IAppGrain> >() .As <ICommandMiddleware>(); services.AddSingletonAs <GrainCommandMiddleware <ContentCommand, IContentGrain> >() .As <ICommandMiddleware>(); services.AddSingletonAs <GrainCommandMiddleware <SchemaCommand, ISchemaGrain> >() .As <ICommandMiddleware>(); services.AddSingletonAs <GrainCommandMiddleware <RuleCommand, IRuleGrain> >() .As <ICommandMiddleware>(); services.AddSingletonAs <CreateBlogCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <CreateProfileCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <AppsByNameIndexCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <AppsByUserIndexCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <RulesByAppIndexCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <SchemasByAppIndexCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <JintScriptEngine>() .As <IScriptEngine>(); services.AddSingleton <Func <IGrainCallContext, string> >(DomainObjectGrainFormatter.Format); services.AddSingleton(c => { var uiOptions = c.GetRequiredService <IOptions <MyUIOptions> >(); var result = new InitialPatterns(); foreach (var pattern in uiOptions.Value.RegexSuggestions) { if (!string.IsNullOrWhiteSpace(pattern.Key) && !string.IsNullOrWhiteSpace(pattern.Value)) { result[Guid.NewGuid()] = new AppPattern(pattern.Key, pattern.Value); } } return(result); }); }
public static void AddMyWriteServices(this IServiceCollection services) { services.AddSingletonAs <NoopUserEvents>() .As <IUserEvents>(); services.AddSingletonAs <JintScriptEngine>() .As <IScriptEngine>(); services.AddSingletonAs <ETagCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <EnrichWithTimestampCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <EnrichWithActorCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <EnrichWithAppIdCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <EnrichWithSchemaIdCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <AppCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <AssetCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <ContentCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <SchemaCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <RuleCommandMiddleware>() .As <ICommandMiddleware>(); services.AddSingletonAs <CreateBlogCommandMiddleware>() .As <ICommandMiddleware>(); services.AddTransientAs <MigrationPath>() .As <IMigrationPath>(); services.AddTransientAs <ConvertEventStore>() .As <IMigration>(); services.AddTransientAs <AddPatterns>() .As <IMigration>(); services.AddTransientAs <RebuildContents>() .As <IMigration>(); services.AddTransientAs <RebuildSnapshots>() .As <IMigration>(); services.AddTransientAs <RebuildAssets>() .As <IMigration>(); services.AddTransientAs <Rebuilder>() .AsSelf(); services.AddTransientAs <AppDomainObject>() .AsSelf(); services.AddTransientAs <AssetDomainObject>() .AsSelf(); services.AddTransientAs <ContentDomainObject>() .AsSelf(); services.AddTransientAs <RuleDomainObject>() .AsSelf(); services.AddTransientAs <SchemaDomainObject>() .AsSelf(); services.AddSingleton <InitialPatterns>(c => { var config = c.GetRequiredService <IOptions <MyUIOptions> >(); var result = new InitialPatterns(); foreach (var pattern in config.Value.RegexSuggestions) { if (!string.IsNullOrWhiteSpace(pattern.Key) && !string.IsNullOrWhiteSpace(pattern.Value)) { result[Guid.NewGuid()] = new AppPattern(pattern.Key, pattern.Value); } } return(result); }); }
public AddPatterns(InitialPatterns initialPatterns, IAppRepository appRepository, IGrainFactory grainFactory) { this.initialPatterns = initialPatterns; this.appRepository = appRepository; this.grainFactory = grainFactory; }