Beispiel #1
0
 public Client(IConfigure configure)
 {
     //初始化中间件
     middleWareHandler = new MiddleWareHandler <HttpContext>();
     middleWare        = new MiddleWare <HttpContext>(middleWareHandler);
     configure.Configure(middleWare);
 }
 /// <summary>
 /// Initializes a new instance of <see cref="ExecutionContextFactory"/>
 /// </summary>
 /// <param name="principalResolver"><see cref="ICanResolvePrincipal"/> for resolving the identity</param>
 /// <param name="detailsPopulator">A <see cref="IExecutionContextDetailsPopulator"/> to use for populating any <see cref="IExecutionContext"/> being created</param>
 /// <param name="configure">A <see cref="IConfigure"/> instance holding all configuration</param>
 /// <param name="tenantManager">A <see cref="ITenantManager"/> to get <see cref="ITenant">tenants</see> from</param>
 public ExecutionContextFactory(ICanResolvePrincipal principalResolver, IExecutionContextDetailsPopulator detailsPopulator, IConfigure configure, ITenantManager tenantManager)
 {
     _principalResolver = principalResolver;
     _detailsPopulator = detailsPopulator;
     _configure = configure;
     _tenantManager = tenantManager;
 }
Beispiel #3
0
        IPersist IPeristProvider.CreatePersist(IConfigure Configure)
        {
            Task <IPersist> toReturn = ((IPeristProvider)this).CreatePersistAsync(Configure);

            toReturn.Wait();
            return(toReturn.Result);
        }
Beispiel #4
0
        public void Configure(IConfigure configure)
        {
            configure
                .Serialization
                    .UsingJson()
                .Frontend
                    .Web(w =>
                    {
                        w.AsSinglePageApplication();
                        w.PathsToNamespaces.Clear();

                        var baseNamespace = global::Bifrost.Configuration.Configure.Instance.EntryAssembly.GetName().Name;
                        var @namespace = string.Format("{0}.**.", baseNamespace);

                        w.PathsToNamespaces.Add("**/", @namespace);
                        w.PathsToNamespaces.Add("/**/", @namespace);
                        w.PathsToNamespaces.Add("", baseNamespace);

                        w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Domain.**.", baseNamespace));
                        w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Read.**.", baseNamespace));
                        w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.**.", baseNamespace));
                    });

            RouteTable.Routes.AddService<ResponseService>("Tenants/Response");
        }
        public void Configure(IConfigure configure)
        {
            configure
            .Serialization
            .UsingJson()

#if (true)
            .Frontend
            .Web(w =>
            {
                w.AsSinglePageApplication();

                var baseNamespace = global::Bifrost.Configuration.Configure.Instance.EntryAssembly.GetName().Name;
                var @namespace    = string.Format("{0}.**.", baseNamespace);

                w.PathsToNamespaces.Add("**/", @namespace);
                w.PathsToNamespaces.Add("/**/", @namespace);
                w.PathsToNamespaces.Add("", baseNamespace);

                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Domain.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Read.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.**.", baseNamespace));
            });
#endif

            configure.Container.Get <IMessageBroker>();
            configure.Container.Get <ICartRepository>().Configure();
            configure.Container.Get <ICategoryRepository>().Configure();
        }
Beispiel #6
0
        private static void GetImage(IConfigure cfgIfc, string imageName, string imageSaveToName)
        {
            ILog _log = LogManager.GetCurrentClassLogger();

            try
            {
                _log.Trace(m => m("Start getting image: {0}", imageName));
                NuvoImage img = cfgIfc.GetImage(imageName);
                if (img == null)
                {
                    _log.Error(m => m("Cannot load Image: {0}", imageName));
                }
                else
                {
                    Console.WriteLine("Image details: {0}", img.ToString());
                    _log.Trace(m => m("Image details: {0}", img.ToString()));
                    img.Picture.Save(imageSaveToName);
                    _log.Trace(m => m("Image saved to: {0}", imageSaveToName));
                }
            }
            catch (Exception exc)
            {
                _log.Fatal(m => m("Exception getting image '{0}': {1}", imageName, exc));
            }
        }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of <see cref="ExecutionContextFactory"/>
 /// </summary>
 /// <param name="principalResolver"><see cref="ICanResolvePrincipal"/> for resolving the identity</param>
 /// <param name="detailsPopulator">A <see cref="IExecutionContextDetailsPopulator"/> to use for populating any <see cref="IExecutionContext"/> being created</param>
 /// <param name="configure">A <see cref="IConfigure"/> instance holding all configuration</param>
 /// <param name="tenantManager">A <see cref="ITenantManager"/> to get <see cref="ITenant">tenants</see> from</param>
 public ExecutionContextFactory(ICanResolvePrincipal principalResolver, IExecutionContextDetailsPopulator detailsPopulator, IConfigure configure, ITenantManager tenantManager)
 {
     _principalResolver = principalResolver;
     _detailsPopulator  = detailsPopulator;
     _configure         = configure;
     _tenantManager     = tenantManager;
 }
        public static IConfigure ConfigureDependencyResolver(this IConfigure configure)
        {
            var dependencyResolver = new ContainerDependencyResolver(configure.Container);

            DependencyResolver.SetResolver(dependencyResolver);
            return(configure);
        }
Beispiel #9
0
        public void Configure(IConfigure configure)
        {
            var entitiesPath             = "./App_Data/Entities";
            var eventsPath               = "./App_Data/Events";
            var eventSequenceNumbersPath = "./App_Data/EventSequenceNumbers";
            var eventProcessorsStatePath = "./App_Data/EventProcessors";

            var redis = "dolittle.redis.cache.windows.net:6380,password=yGQibET0Re058gvkGz0VaObJzcY4rKFitMy1PWCfFd4=,ssl=True,abortConnect=False";

            configure
            .Application("QuickStart", a => a.Structure(s => s
                                                        .Domain("Web.Domain.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                        .Events("Web.Events.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                        .Read("Web.Read.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                        .Frontend("Web.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                        ))

            .Events(e =>
            {
                //e.EventStore.UsingFiles(eventsPath);
                //e.EventSequenceNumbers.UsingFiles(eventSequenceNumbersPath);
                //e.EventProcessorStates.UsingFiles(eventProcessorsStatePath);

                e.EventProcessorStates.UsingRedis(redis);
                e.EventSourceVersions.UsingRedis(redis);
                e.EventSequenceNumbers.UsingRedis(redis);
                e.EventStore.UsingTables("DefaultEndpointsProtocol=https;AccountName=dolittle;AccountKey=XcfKv4RV5Hd3My4PbXlBATvLhvI0TpZmP5jwcCFbiILM/kESPr6pibI8hdD3+qPpe+UZ5OlmWUI7Z7qSKlRwuQ==;EndpointSuffix=core.windows.net");
            })

            .Serialization
            .UsingJson()

            .DefaultStorage
            .UsingFiles(entitiesPath)

            .Frontend
            .Web(w =>
            {
                w.AsSinglePageApplication();
                w.PathsToNamespaces.Clear();

                var baseNamespace = global::Bifrost.Configuration.Configure.Instance.EntryAssembly.GetName().Name;

                // Normally you would use the base namespace from the assembly - but since the demo code is written for a specific namespace
                // all the conventions in Bifrost won't work.
                // Recommend reading up on the namespacing and conventions related to it:
                // https://dolittle.github.io/bifrost/Frontend/JavaScript/namespacing.html
                baseNamespace = "Web";

                var @namespace = string.Format("{0}.**.", baseNamespace);

                w.PathsToNamespaces.Add("**/", @namespace);
                w.PathsToNamespaces.Add("/**/", @namespace);
                w.PathsToNamespaces.Add("", baseNamespace);

                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Domain.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Read.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.**.", baseNamespace));
            });
        }
Beispiel #10
0
        void ConfigureSignalR(IConfigure configure)
        {
            var resolver = new BifrostDependencyResolver(configure.Container);

            var serializerSettings = new JsonSerializerSettings
            {
                ContractResolver = new FilteredCamelCasePropertyNamesContractResolver(),
                Converters       = { new ConceptConverter(), new ConceptDictionaryConverter() }
            };
            var jsonSerializer = JsonSerializer.Create(serializerSettings);

            resolver.Register(typeof(JsonSerializer), () => jsonSerializer);

            GlobalHost.DependencyResolver = resolver;

            var hubConfiguration = new HubConfiguration {
                Resolver = resolver
            };

            RouteTable.Routes.MapOwinPath("/signalr", a => a.RunSignalR(hubConfiguration));
            var route = RouteTable.Routes.Last();

            RouteTable.Routes.Remove(route);
            RouteTable.Routes.Insert(0, route);
        }
 /// <summary>
 /// Start configuration the application
 /// </summary>
 /// <param name="configure"><see cref="IConfigure">Configureation</see> to configure</param>
 /// <param name="name">Name of the application</param>
 /// <param name="builderCallback">Callback for building</param>
 /// <returns><see cref="IConfigure">Configuration</see> instance</returns>
 public static IConfigure    Application(this IConfigure configure, ApplicationName name, Func<IApplicationConfigurationBuilder, IApplicationConfigurationBuilder> builderCallback)
 {
     IApplicationConfigurationBuilder applicationConfigurationBuilder = new ApplicationConfigurationBuilder(name);
     applicationConfigurationBuilder = builderCallback(applicationConfigurationBuilder);
     var application = applicationConfigurationBuilder.Build();
     configure.Container.Bind(application);
     return configure;
 }
Beispiel #12
0
        /// <summary>
        /// Confugre eventing
        /// </summary>
        /// <param name="configure"></param>
        /// <param name="eventsConfigurationCallback"></param>
        /// <returns></returns>
        public static IConfigure Events(this IConfigure configure, Action <IEventsConfiguration> eventsConfigurationCallback)
        {
            var eventsConfiguration = new EventsConfiguration();

            configure.Container.Bind <IEventsConfiguration>(eventsConfiguration);
            eventsConfigurationCallback(eventsConfiguration);
            return(configure);
        }
        /// <summary>
        /// Initializes an instance of <see cref="CommandValidatorProvider"/> CommandValidatorProvider
        /// </summary>
        /// <param name="typeDiscoverer">
        /// An instance of ITypeDiscoverer to help identify and register <see cref="ICommandInputValidator"/> implementations
        /// and  <see cref="ICommandBusinessValidator"/> implementations
        /// </param>
        /// <param name="container">An instance of <see cref="IContainer"/> to manage instances of any <see cref="ICommandInputValidator"/></param>
        /// <param name="configuration">An instance of <see cref="IConfigure"/> that holds the current configuration</param>
        public CommandValidatorProvider(ITypeDiscoverer typeDiscoverer, IContainer container, IConfigure configuration)
        {
            _typeDiscoverer = typeDiscoverer;
            _container = container;
            _configuration = configuration;

            Initialize();
        }
Beispiel #14
0
        public void Configure(IConfigure configure)
        {
            var entitiesPath             = HttpContext.Current.Server.MapPath("~/App_Data/Entities");
            var eventsPath               = HttpContext.Current.Server.MapPath("~/App_Data/Events");
            var eventSequenceNumbersPath = HttpContext.Current.Server.MapPath("~/App_Data/EventSequenceNumbers");
            var eventProcessorsStatePath = HttpContext.Current.Server.MapPath("~/App_Data/EventProcessors");


            configure
            .Serialization
            .UsingJson()
            .Events(e =>
            {
                e.EventStore.UsingFiles(eventsPath);
                e.EventSequenceNumbers.UsingFiles(eventSequenceNumbersPath);
                e.EventProcessorStates.UsingFiles(eventProcessorsStatePath);
            })


            // For using MongoDB - install the nuget package : install-package Bifrost.MongoDB and comment out the .UsingFiles(...) line above and uncomment the line below
            //.UsingMongoDB(e => e.WithUrl("http://*****:*****@namespace    = string.Format("{0}.**.", baseNamespace);

                w.PathsToNamespaces.Add("**/", @namespace);
                w.PathsToNamespaces.Add("/**/", @namespace);
                w.PathsToNamespaces.Add("", baseNamespace);

                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Domain.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Read.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.**.", baseNamespace));
            });
            //.WithMimir();
        }
Beispiel #15
0
        public void Configure(IConfigure configure)
        {
            var entitiesPath             = HttpContext.Current.Server.MapPath("~/App_Data/Entities");
            var eventsPath               = HttpContext.Current.Server.MapPath("~/App_Data/Events");
            var eventSequenceNumbersPath = HttpContext.Current.Server.MapPath("~/App_Data/EventSequenceNumbers");
            var eventProcessorsStatePath = HttpContext.Current.Server.MapPath("~/App_Data/EventProcessors");
            var eventSourceVersionsPath  = HttpContext.Current.Server.MapPath("~/App_Data/EventSourceVersions");

            configure
            .Application("QuickStart", a => a.Structure(s => s
                                                        .Domain("Web.Domain.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                        .Events("Web.Events.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                        .Read("Web.Read.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                        .Frontend("Web.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                        ))

            .Events(e =>
            {
                e.EventStore.UsingFiles(eventsPath);
                e.EventSequenceNumbers.UsingFiles(eventSequenceNumbersPath);
                e.EventProcessorStates.UsingFiles(eventProcessorsStatePath);
                e.EventSourceVersions.UsingFiles(eventSourceVersionsPath);
            })

            .Serialization
            .UsingJson()


            .DefaultStorage
            .UsingFiles(entitiesPath)

            .Frontend
            .Web(w =>
            {
                w.AsSinglePageApplication();
                w.PathsToNamespaces.Clear();

                var baseNamespace = global::Bifrost.Configuration.Configure.Instance.EntryAssembly.GetName().Name;

                // Normally you would use the base namespace from the assembly - but since the demo code is written for a specific namespace
                // all the conventions in Bifrost won't work.
                // Recommend reading up on the namespacing and conventions related to it:
                // https://dolittle.github.io/bifrost/Frontend/JavaScript/namespacing.html
                baseNamespace = "Web";

                var @namespace = string.Format("{0}.**.", baseNamespace);

                w.PathsToNamespaces.Add("**/", @namespace);
                w.PathsToNamespaces.Add("/**/", @namespace);
                w.PathsToNamespaces.Add("", baseNamespace);

                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Domain.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Read.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.**.", baseNamespace));
            });

            RouteTable.Routes.AddService <SecuredService>();
        }
Beispiel #16
0
        public void Initialize(IConfigure configure)
        {
            /*
            if( RepositoryType != null )
                configure.Container.Bind<IEventRepository>(RepositoryType);*/

            if (EventStoreType != null)
                configure.Container.Bind<IEventStore>(EventStoreType);
        }
Beispiel #17
0
 public static OnDemandCollector ConfigurePrometheus(IConfigure configure, core.config.MetricFile metricFile, CollectorRegistry registry)
 {
     return(new OnDemandCollector(
                configure.DataSource,
                metricFile.MillisecondTimeout,
                registry,
                metricFactory => ConfigureMetrics(metricFile, metricFactory)
                ));
 }
Beispiel #18
0
        public static IConfigure Message(this IConfigure configure, Action <IMessageConfiguration> configAction)
        {
            Throw.IfArgumentNull(configure, nameof(configure));
            IMessageConfiguration messageConfiguration = new MessageConfiguration(configure);

            configAction(messageConfiguration);
//            configure.RegisterServices(s => s.AddSingleton(messageConfiguration));
            return(configure);
        }
Beispiel #19
0
        public async Task Configured(IConfigure configure)
        {
            await _unitOfWorkManager.PerformAsyncUow(async() =>
            {
                foreach (var permissionProvider in _permissionProviders)
                {
                    // get and iterate stereotypical groups of permissions
                    var stereotypes = permissionProvider.GetDefaultStereotypes();
                    foreach (var stereotype in stereotypes)
                    {
                        var role = await _roleManager.FindByNameAsync(stereotype.Name);
                        if (role == null)
                        {
                            if (_logger.IsEnabled(LogLevel.Information))
                            {
                                _logger.LogInformation(
                                    $"Defining new role {stereotype.Name} for permission stereotype");
                            }

                            role = new Role {
                                RoleName = stereotype.Name
                            };
                            await _roleManager.CreateAsync(role);
                            await _unitOfWorkManager.Current.SaveChangesAsync();
                        }

                        // and merge the stereotypical permissions into that role
                        var stereotypePermissionNames =
                            (stereotype.Permissions ?? Enumerable.Empty <Permission>()).Select(x => x.Name);
                        var currentPermissionNames = (await _roleManager.GetClaimsAsync(role)).Where(x => x.Type == Permission.ClaimType)
                                                     .Select(x => x.Value).ToList();

                        var distinctPermissionNames = currentPermissionNames
                                                      .Union(stereotypePermissionNames)
                                                      .Distinct();

                        // update role if set of permissions has increased
                        var additionalPermissionNames = distinctPermissionNames.Except(currentPermissionNames).ToList();

                        if (additionalPermissionNames.Any())
                        {
                            foreach (var permissionName in additionalPermissionNames)
                            {
                                if (_logger.IsEnabled(LogLevel.Debug))
                                {
                                    _logger.LogInformation("Default role {0} granted permission {1}", stereotype.Name,
                                                           permissionName);
                                }

                                await _roleManager.AddClaimAsync(role, new Claim(Permission.ClaimType, permissionName));
                            }
                        }
                    }
                }
            });
        }
 public void Configured(IConfigure configure)
 {
     Task.Run(() =>
     {
         for (;;)
         {
             _consumer.Poll(TimeSpan.FromMilliseconds(50));
         }
     });
 }
        public Task Configured(IConfigure configure)
        {
            if (configure.BackgroundJobs.IsJobExecutionEnabled)
            {
                _backgroundWorkerManager.Start();
                _backgroundWorkerManager.Add(_backgroundJobManager);
            }

            return(Task.FromResult(0));
        }
Beispiel #22
0
 /// <summary>
 /// Enables common service locator and sets the <see cref="IContainer">container</see> as the source of location
 /// </summary>
 /// <param name="configure"><see cref="IConfigure"/> object to configure</param>
 /// <returns>Chained <see cref="IConfigure"/></returns>
 public static IConfigure UsingCommonServiceLocator(this IConfigure configure)
 {
     if (!_configured)
     {
         var serviceLocator = new ContainerServiceLocator(configure.Container);
         configure.Container.Bind <IServiceLocator>(serviceLocator);
         ServiceLocator.SetLocatorProvider(() => serviceLocator);
         _configured = true;
     }
     return(Configure.Instance);
 }
Beispiel #23
0
        public void Configure(IConfigure configure)
        {
            configure.CallContext.WithCallContextTypeOf<WebCallContext>();
            var container = configure.Container;

            ConfigureSignalR(configure.Container);

            RegisterBifrostAssets();
            var implementorFinder = container.Get<IImplementorFinder>();
            RegisterBifrostServices(implementorFinder.GetImplementorsFor(typeof(IBifrostService)));
            RegisterBifrostHttpHandlers(implementorFinder.GetImplementorsFor(typeof(IBifrostHttpHandler)));
        }
Beispiel #24
0
        public void Configure(IConfigure configure)
        {
            var currentDir = Directory.GetCurrentDirectory();

            var eventsPath = $"{currentDir}/Console/Events";

            configure
            .Serialization
            .UsingJson()
            .Events
            .UsingFiles(eventsPath);
        }
        public ConfigurationFileReader(
			IConfigure configure, 
			IFileSystemWatcher fileSystemWatcher, 
			IYamlParser yamlParser,
			IHarnessManager harnessManager)
        {
            _fileSystemWatcher = fileSystemWatcher;
            _yamlParser = yamlParser;
            _harnessManager = harnessManager;

            fileSystemWatcher.SubscribeToChanges(FileChanged);
        }
Beispiel #26
0
        public void Configure(IConfigure configure)
        {
            var basePath                 = "./EventStore";
            var entitiesPath             = Path.Combine("./", "Entities");
            var eventsPath               = Path.Combine(basePath, "Events");
            var eventSequenceNumbersPath = Path.Combine(basePath, "EventSequenceNumbers");
            var eventProcessorsStatePath = Path.Combine(basePath, "EventProcessors");
            var eventSourceVersionsPath  = Path.Combine(basePath, "EventSourceVersions");

            configure
            .Application("Basic", a => a.Structure(s => s
                                                   .Domain("Domain.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                   .Events("Events.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                   .Read("Read.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                   .Read("TextAnalytics.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                   .Frontend("Web.{BoundedContext}.-{Module}.-{Feature}.^{SubFeature}*")
                                                   ))
            .Events(e =>
            {
                e.EventStore.UsingFiles(eventsPath);
                e.EventSequenceNumbers.UsingFiles(eventSequenceNumbersPath);
                e.EventProcessorStates.UsingFiles(eventProcessorsStatePath);
                e.EventSourceVersions.UsingFiles(eventSourceVersionsPath);
            })

            .Serialization
            .UsingJson()

            .DefaultStorage
            .UsingFiles(entitiesPath)

            .Frontend
            .Web(w =>
            {
                w.AsSinglePageApplication();
                w.PathsToNamespaces.Clear();

                var baseNamespace = "Web";

                var @namespace = string.Format("{0}.**.", baseNamespace);

                w.PathsToNamespaces.Add("**/", @namespace);
                w.PathsToNamespaces.Add("/**/", @namespace);
                w.PathsToNamespaces.Add("", baseNamespace);

                w.NamespaceMapper.Add($"{baseNamespace}.**.", "Concepts.**.");
                w.NamespaceMapper.Add($"{baseNamespace}.**.", "Domain.**.");
                w.NamespaceMapper.Add($"{baseNamespace}.**.", "Read.**.");
                w.NamespaceMapper.Add($"{baseNamespace}.**.", "Events.**.");
                w.NamespaceMapper.Add($"{baseNamespace}.**.", $"{baseNamespace}.**.");
            });
        }
Beispiel #27
0
        public override void OnConfigure(IConfigure configure)
        {
            var connectionString = ConfigurationManager.AppSettings["MONGOHQ_URL"]; // "mongodb://*****:*****@alex.mongohq.com:10046/61454f3e_9890_48bb_8a1e_e0fc0127a648";
            var database = ConfigurationManager.AppSettings["MONGO_DB"];// "61454f3e_9890_48bb_8a1e_e0fc0127a648";

            configure
                .UsingConfigConfigurationSource()
                .Sagas.WithoutLibrarian()
                .Serialization.UsingJson()
                .UsingMongoDb(connectionString, database)
                .AsSinglePageApplication();
            base.OnConfigure(configure);
        }
Beispiel #28
0
        public static IWebHostBuilder CreateWebHostBuilder(string[] args, IConfigure configurationBinding, CollectorRegistry registry)
        {
            var defaultPath = "/" + configurationBinding.ServerPath.Replace("/", string.Empty, StringComparison.CurrentCultureIgnoreCase);

            if (defaultPath.Equals("/", StringComparison.CurrentCultureIgnoreCase))
            {
                defaultPath = string.Empty;
            }

            return(WebHost.CreateDefaultBuilder(args)
                   .Configure(app => app.UseMetricServer(defaultPath, registry))
                   .UseUrls($"http://*:{configurationBinding.ServerPort}"));
        }
Beispiel #29
0
        public void Configure(IConfigure configure)
        {
            var entitiesPath = HttpContext.Current.Server.MapPath("~/App_Data/Entities");
            var eventsPath = HttpContext.Current.Server.MapPath("~/App_Data/Events");

            configure
                .Serialization
                    .UsingJson()
                .Events
                    .UsingFiles(eventsPath)

                    // For using MongoDB - install the nuget package : install-package Bifrost.MongoDB and comment out the .UsingFiles(...) line above and uncomment the line below
                    //.UsingMongoDB(e => e.WithUrl("http://*****:*****@namespace = string.Format("{0}.**.", baseNamespace);

                        w.PathsToNamespaces.Add("**/", @namespace);
                        w.PathsToNamespaces.Add("/**/", @namespace);
                        w.PathsToNamespaces.Add("", baseNamespace);

                        w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Domain.**.", baseNamespace));
                        w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Read.**.", baseNamespace));
                        w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.**.", baseNamespace));
                    })
                .WithMimir();
        }
Beispiel #30
0
        public void Configure(IConfigure configure)
        {
            var dataPath = HttpContext.Current.Server.MapPath("~/App_Data");
            configure
                .Serialization
                    .UsingJson()
                .Events
                    .UsingRavenDBEmbedded(e=>e.LocatedAt(dataPath).WithManagementStudio())
                .Events
                    .Asynchronous(e=>e.UsingSignalR())
                .DefaultStorage
                    .UsingRavenDBEmbedded(e=>e.LocatedAt(dataPath))
                .Frontend
					.Web(w=>w.AsSinglePageApplication())
                .WithMimir();
        }
Beispiel #31
0
        public void Configure(IConfigure configure)
        {
            var dataPath = HttpContext.Current.Server.MapPath("~/App_Data");
            configure
                .Serialization
                    .UsingJson()
                .Events
                    .UsingRavenDB(e=>e.WithUrl("http://localhost:8080").WithDefaultDatabase("QuickStart"))
                    //.UsingRavenDBEmbedded(e=>e.LocatedAt(dataPath).WithManagementStudio())
                .Events
                    .Asynchronous(e=>e.UsingSignalR())
                .DefaultStorage
                    .UsingRavenDB(e => e.WithUrl("http://localhost:8080").WithDefaultDatabase("QuickStart"))
                    //.UsingRavenDBEmbedded(e=>e.LocatedAt(dataPath))
                .Frontend
                    .Web(w=> {
                        w.AsSinglePageApplication();
                        w.PathsToNamespaces.Clear();
                        w.PathsToNamespaces.Add("Visualizer/**/", "Bifrost.Visualizer.**.");
                        w.PathsToNamespaces.Add("Bifrost/Visualizer/**/", "Bifrost.Visualizer.**.");
                        w.PathsToNamespaces.Add("/Visualizer/**/", "Bifrost.Visualizer.**.");
                        w.PathsToNamespaces.Add("/Bifrost/Visualizer/**/", "Bifrost.Visualizer.**.");

                        w.PathsToNamespaces.Add("Visualizer", "Bifrost.Visualizer");
                        w.PathsToNamespaces.Add("Bifrost/Visualizer", "Bifrost.Visualizer");
                        w.PathsToNamespaces.Add("/Visualizer", "Bifrost.Visualizer");
                        w.PathsToNamespaces.Add("/Bifrost/Visualizer", "Bifrost.Visualizer");



                        w.PathsToNamespaces.Add("Visualizer/**/", "Bifrost.Visualizer.**.");
                        w.PathsToNamespaces.Add("/Visualizer/**/", "Bifrost.Visualizer.**.");
                        w.PathsToNamespaces.Add("Bifrost/Visualizer/**/", "Bifrost.Visualizer.**.");
                        w.PathsToNamespaces.Add("/Bifrost/Visualizer/**/", "Bifrost.Visualizer.**.");

                        w.PathsToNamespaces.Add("Features/**/", "Bifrost.QuickStart.Features.**.");
                        w.PathsToNamespaces.Add("/Features/**/", "Bifrost.QuickStart.Features.**.");
                        w.NamespaceMapper.Add("Bifrost.QuickStart.Features.**.", "Bifrost.QuickStart.Domain.HumanResources.**.");

                        w.NamespaceMapper.Add("Bifrost.QuickStart.Domain.HumanResources.**.", "Bifrost.QuickStart.Features.**.");
                        w.NamespaceMapper.Add("Bifrost.QuickStart.Read.HumanResources.**.", "Bifrost.QuickStart.Features.**.");
					})
                .WithMimir();

            RouteTable.Routes.AddService<SecuredService>();
        }
Beispiel #32
0
        /// <summary>
        /// load generators from assembly
        /// </summary>
        public static void InitComponents(Assembly a, ref List <IConfigure> gens)
        {
            string interfacename = typeof(IConfigure).FullName;

            Type[] types = a.GetTypes();
            foreach (Type t in types)
            {
                List <Type> interfaces = new List <Type>(t.GetInterfaces());
                if (interfaces.Exists(delegate(Type type) { return(type.FullName == interfacename); }))
                {
                    IConfigure igc = (IConfigure)a.CreateInstance(t.FullName);
                    if (igc.Properties.ContainsKey(GenProperties.IsEnabled) && (bool)igc.Properties[GenProperties.IsEnabled] == false)
                    {
                        continue;
                    }
                    gens.Add(igc);
                }
            }
        }
Beispiel #33
0
        private void buttonClickEvent_Executed(object sender, EventArgs e)
        {
            CellContext context = (CellContext)sender;
            Button      cell    = (Button)context.Cell;

            try
            {
                IConfigure plugin = cell.Row.Tag as IConfigure;
                if (plugin != null)
                {
                    plugin.Configure(this);
                }
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);

                MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #34
0
        /// <summary>
        /// Initializes the connection to the service.
        /// Starts the timer to periodically renew the lease.
        /// </summary>
        private void Initialize()
        {
            try
            {
                _log.Trace(m => m("Configuration Proxy; Initialize()"));

                _cfgServiceProxy = CreateConfigureClient();

                _timerRenewLease = new Timer(OnRenewLeaseCallback);
                _timerRenewLease.Change(RENEW_LEASE_TIME, Timeout.Infinite);

                _log.Trace(m => m("Configuration Proxy; Initialize() done."));
            }
            catch (Exception exc)
            {
                _log.Fatal("Creating connection to the service failed.", exc);
                (_cfgServiceProxy as ConfigureClient).Abort();
                throw exc;
            }
        }
        public static IConfigure UsingFluentValidation(this IConfigure configure)
        {
            //DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;

            var factory = configure.Container.Get <CommandValidatorFactory>();

            FluentValidationModelValidatorProvider.Configure(p =>
            {
                p.ValidatorFactory             = factory;
                p.AddImplicitRequiredValidator = false;
            });

            var validatorFactory  = configure.Container.Get <DefaultValidatorFactory>();
            var validatorProvider = new FluentValidationModelValidatorProvider(validatorFactory);

            validatorProvider.AddImplicitRequiredValidator = false;
            ModelValidatorProviders.Providers.Add(validatorProvider);

            return(configure);
        }
Beispiel #36
0
        void ConfigureSignalR(IConfigure configure)
        {
            var resolver = new BifrostDependencyResolver(configure.Container);

            var serializerSettings = new JsonSerializerSettings
            {
                ContractResolver = new FilteredCamelCasePropertyNamesContractResolver(),
                Converters = { new ConceptConverter(), new ConceptDictionaryConverter() }
            };
            var jsonSerializer = JsonSerializer.Create(serializerSettings);
            resolver.Register(typeof(JsonSerializer), () => jsonSerializer);

            GlobalHost.DependencyResolver = resolver;

            var hubConfiguration = new HubConfiguration { Resolver = resolver };

            RouteTable.Routes.MapOwinPath("/signalr", a => a.RunSignalR(hubConfiguration));
            var route = RouteTable.Routes.Last();
            RouteTable.Routes.Remove(route);
            RouteTable.Routes.Insert(0, route);
        }
Beispiel #37
0
        public void Configure(IConfigure configure)
        {
            var connectionString = ConfigurationManager.AppSettings["Database"];
            var userName = ConfigurationManager.AppSettings["RavenUsername"];
            var password = ConfigurationManager.AppSettings["RavenPassword"];

            var entityIds = new EntityIdPropertyRegister();
            entityIds.RegisterIdProperty<ReadingStream, ReaderId>(rs => rs.Reader);
            entityIds.RegisterIdProperty<MyChirps, ChirperId>(c => c.Chirper);
            entityIds.RegisterIdProperty<Read.Streams.Chirp, ChirpId>(c => c.Id);
            entityIds.RegisterIdProperty<Chirper, ChirperId>(c => c.ChirperId);
            entityIds.RegisterIdProperty<Follower, FollowerId>(c => c.FollowerId);
            entityIds.RegisterIdProperty<Read.Domain.Chirping.ChirperId, ChirperId>(c => c.Id);
            entityIds.RegisterIdProperty<ChirpersFollowers, ChirperId>(c => c.Chirper);
            entityIds.RegisterIdProperty<FollowerFollows, FollowerId>(c => c.Follower);
            entityIds.RegisterIdProperty<MyFollowers, ChirperId>(c => c.ChirperId);
            entityIds.RegisterIdProperty<MyFollows, FollowerId>(c => c.FollowerId);

            configure
                .Events.Asynchronous()
                .Events.UsingRavenDB(c =>
                {
                    c.WithUrl(connectionString);
                    c.WithDefaultDatabase("Chirp");
                    if (!string.IsNullOrEmpty(userName))
                        c.WithCredentials(new NetworkCredential(userName, password));
                })
                .Serialization.UsingJson()
                .DefaultStorage.UsingRavenDB(c =>
                {
                    c.WithUrl(connectionString);
                    c.WithDefaultDatabase("Chirp");
                    if (!string.IsNullOrEmpty(userName))
                        c.WithCredentials(new NetworkCredential(userName, password));
                    c.IdPropertyRegister = entityIds;

                })
                .Frontend.Web(w => w.AsSinglePageApplication());
            //.WithMimir();
        }
Beispiel #38
0
        public void Configure(IConfigure configure)
        {
            var dataPath = HttpContext.Current.Server.MapPath("~/App_Data");
            configure
                .Serialization
                    .UsingJson()
                .Events
                    .UsingRavenDB(e=>e.WithUrl("http://localhost:8080").WithDefaultDatabase("QuickStart"))
                    //.UsingRavenDBEmbedded(e=>e.LocatedAt(dataPath).WithManagementStudio())
                .Events
                    .Asynchronous(e=>e.UsingSignalR())
                .DefaultStorage
                    .UsingRavenDB(e => e.WithUrl("http://localhost:8080").WithDefaultDatabase("QuickStart"))
                    //.UsingRavenDBEmbedded(e=>e.LocatedAt(dataPath))
                .Frontend
                    .Web(w=> {
                        w.AsSinglePageApplication();
                        w.PathsToNamespaces.Clear();
                        w.PathsToNamespaces.Add("Features/**/", "Bifrost.QuickStart.Features.**.");
                        w.PathsToNamespaces.Add("/Features/**/", "Bifrost.QuickStart.Features.**.");
                        w.NamespaceMapper.Add("Bifrost.QuickStart.Features.**.", "Bifrost.QuickStart.Domain.HumanResources.**.");
                        w.NamespaceMapper.Add("Bifrost.QuickStart.Features.**.", "Bifrost.QuickStart.Read.HumanResources.**.");
					})
                .WithMimir();

            var validatorProvider = configure.Container.Get<ICommandValidatorProvider>();
            var inputValidator = validatorProvider.GetInputValidatorFor(typeof (RegisterEmployee));
            var businessValidator = validatorProvider.GetBusinessValidatorFor(typeof (RegisterEmployee));

            var command = new RegisterEmployee()
                {
                    SocialSecurityNumber = "invalid"
                };

            var inputResult = inputValidator.ValidateFor(command);
            var businessResult = businessValidator.ValidateFor(command);
        }
 public void Initialize(IConfigure configure)
 {
     //if( RepositoryType != null )
     //    configure.Container.Bind<IEventRepository>(RepositoryType);
 }
Beispiel #40
0
 public Program(IConfigure configure, ILogMaker log, ILogInOut logInOut)
 {
     _configure = configure;
     _log       = log;
     _logInOut  = logInOut;
 }
Beispiel #41
0
 public void Configure(IConfigure configure)
 {
     configure.CallContext.WithCallContextTypeOf<WebCallContext>();
     ConfigureSignalR(configure);
 }
Beispiel #42
0
        public void Configure(IConfigure configure)
        {
            var entitiesPath = HttpContext.Current.Server.MapPath("~/App_Data/Entities");
            var eventsPath   = HttpContext.Current.Server.MapPath("~/App_Data/Events");
            var sagasPath    = HttpContext.Current.Server.MapPath("~/App_Data/Sagas");

            configure.Container.Bind <IChapterValidationService>(typeof(ChapterValidationService));
            configure.Sagas.LibrarianType = typeof(SagaLibrarian);

            configure
            .Serialization
            .UsingJson()
            .Events
            .Synchronous()

            .Events
            .UsingFiles(eventsPath)

            // For using MongoDB - install the nuget package : install-package Bifrost.MongoDB and comment out the .UsingMongoDB(...) line above and uncomment the line below
            //.UsingMongoDB(e => e.WithUrl("http://*****:*****@"Data Source=(LocalDB)\v11.0;AttachDbFileName=|DataDirectory|\Database.mdf;Initial Catalog=Database;Integrated Security=True"))
            .UsingFiles(entitiesPath)

            // For using MongoDB - install the nuget package : install-package Bifrost.MongoDB and comment out the .UsingMongoDB(...) line above and uncomment the line below
            //.UsingMongoDB(e => e.WithUrl("http://*****:*****@namespace = string.Format("{0}.**.", baseNamespace);

                w.PathsToNamespaces.Add("**/", @namespace);
                w.PathsToNamespaces.Add("/**/", @namespace);
                w.PathsToNamespaces.Add("", baseNamespace);

                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Domain.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.Read.**.", baseNamespace));
                w.NamespaceMapper.Add(string.Format("{0}.**.", baseNamespace), string.Format("{0}.**.", baseNamespace));
            });

            RouteTable.Routes.AddService <SecuredService>();
        }
#pragma warning disable 1591 // Xml Comments
        public void Initialize(IConfigure configure)
        {
        }
Beispiel #44
0
        public void Configure(IConfigure configure)
        {
            configure.Serialization.UsingJson();

            configure.Frontend.Desktop();
        }
Beispiel #45
0
 public void Configured(IConfigure configure)
 {
     var i = 0;
     i++;
 }
		public FrameworkManager(IConfigure configure)
		{
			_configure = configure;
		}
Beispiel #47
0
 public void Configure(IConfigure configure)
 {
     configure.Serialization.UsingJson();
     
 }
Beispiel #48
0
 public void Configure(IConfigure configure)
 {
     configure.Frontend.Desktop();
 }
Beispiel #49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultConnectionStringResolver"/> class.
 /// </summary>
 public DefaultConnectionStringResolver(IConfigure configuration)
 {
     _configuration = configuration;
 }
 public virtual void OnConfigure(IConfigure configure) { }
 public StorageConfiguration(IConfigure configure)
 {
     Configure = configure;
 }
Beispiel #52
0
 public NotificationConfiguration(IConfigure configure)
 {
     Configure = configure;
 }
        public void Initialize (IConfigure configure)
		{
			if( SerializerType != null )
				configure.Container.Bind<ISerializer>(SerializerType);
		}
Beispiel #54
0
 /// <summary>
 /// Instantiates the Configurator for Validation
 /// </summary>
 /// <param name="configure"></param>
 public void Configure(IConfigure configure)
 {
     ValidatorOptions.DisplayNameResolver = NameResolvers.DisplayNameResolver;
     ValidatorOptions.PropertyNameResolver = NameResolvers.PropertyNameResolver;
 }