Exemplo n.º 1
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Campaign.Service>();
            appHost.RegisterService <Campaign.Entities.Rule.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(Campaign.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Campaign.Entities.Rule.Service));
        }
Exemplo n.º 2
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <User.Service>();
            appHost.RegisterService <Role.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(User.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Role.Service));
        }
Exemplo n.º 3
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<Users.Service>();
            appHost.GetContainer().RegisterAutoWiredType(typeof(Users.Service));

            //appHost.GetContainer().Register<Users.Service>((c) => new Users.Service(c.Resolve<IBus>()));
            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
Exemplo n.º 4
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Users.Service>();
            appHost.GetContainer().RegisterAutoWiredType(typeof(Users.Service));

            //appHost.GetContainer().Register<Users.Service>((c) => new Users.Service(c.Resolve<IBus>()));
            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
Exemplo n.º 5
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Basket.Service>();
            appHost.RegisterService <Basket.Entities.Item.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(Basket.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Basket.Entities.Item.Service));
        }
Exemplo n.º 6
0
        public void Register(IAppHost appHost)
        {
            appHost.GetContainer().RegisterAutoWiredType(typeof(Items.Serials.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Items.Service));
            appHost.RegisterService <Items.Serials.Service>("/items/{ItemId}/serials");
            appHost.RegisterService <Items.Service>("/items");

            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
Exemplo n.º 7
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Location.Service>();
            appHost.RegisterService <Location.Entities.Point.Service>();
            appHost.RegisterService <User.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(Location.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Location.Entities.Point.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(User.Service));
        }
Exemplo n.º 8
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <CatalogBrand.Service>();
            appHost.RegisterService <CatalogType.Service>();
            appHost.RegisterService <Product.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(CatalogBrand.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(CatalogType.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Product.Service));
        }
Exemplo n.º 9
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService <Buyer.Service>();
            appHost.RegisterService <Buyer.Entities.Address.Service>();
            appHost.RegisterService <Buyer.Entities.PaymentMethod.Service>();
            appHost.RegisterService <Order.Service>();
            appHost.RegisterService <Order.Entities.Item.Service>();

            appHost.GetContainer().RegisterAutoWiredType(typeof(Buyer.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Buyer.Entities.Address.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Buyer.Entities.PaymentMethod.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Order.Service));
            appHost.GetContainer().RegisterAutoWiredType(typeof(Order.Entities.Item.Service));
        }
Exemplo n.º 10
0
 // constructor with event handlers
 public DiskAnalysisServicesData(IAppHost appHost, ConcurrentObservableDictionary <string, decimal> pluginRootCOD, NotifyCollectionChangedEventHandler onPluginRootCODCollectionChanged, PropertyChangedEventHandler onPluginRootCODPropertyChanged)
 {
     cacheClient      = appHost.GetContainer().Resolve <ICacheClient>();
     BaseServicesData = appHost.GetContainer().Resolve <BaseServicesData>();
     PluginRootCOD    = pluginRootCOD;
     this.onPluginRootCODCollectionChanged = onPluginRootCODCollectionChanged;
     this.onPluginRootCODPropertyChanged   = onPluginRootCODPropertyChanged;
     pluginRootCOD.CollectionChanged      += this.onPluginRootCODCollectionChanged;
     pluginRootCOD.PropertyChanged        += this.onPluginRootCODPropertyChanged;
     // ToDo: Get the Configuration data into the COD, and populate it from "plugin configuration data load"
     ConstructConfigurationData();
     ConstructUserData();
     ConstructDiskDriveAnalysisData();
     ConstructFileSystemAnalysisData();
 }
Exemplo n.º 11
0
        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            if (container.Exists <IpModuleManager>())
            {
                var manager = container.Resolve <IpModuleManager>();

                manager.DeviceStatusChanged += (sender, args) =>
                {
                    var cb = container.Resolve <IParadoxEventCallbacks>();
                    cb.PutDeviceUpdate(args.Device);
                };

                manager.PartitionStatusChanged += (sender, args) =>
                {
                    var cb = container.Resolve <IParadoxEventCallbacks>();
                    cb.PutPartitionUpdate(args.Partition);
                };
            }
            else
            {
                logger.Error("Cannot find Ip Module Manager to register device and partition status changes events for MQTT");
            }
        }
Exemplo n.º 12
0
        public void Register(IAppHost appHost)
        {
            var container  = appHost.GetContainer();
            var connection = container.Resolve <IDbConnectionFactory>();
            var db         = connection.CreateDbConnection();

            db.Open();
            if (db.CreateTableIfNotExists <Application>())
            {
                db.Insert(new Application()
                {
                    Name         = "Admin",
                    CreatedBy    = "Migration",
                    ModifiedBy   = "Migration",
                    CreatedDate  = DateTime.UtcNow,
                    ModifiedDate = DateTime.UtcNow
                });
            }

            Permissions.All.AddRange(ApplicationsPermissions.All);
            StackXAppHostBase.ExcludedAutoCrudTypes.Remove(typeof(UpdateApplication));
            StackXAppHostBase.ExcludedAutoCrudTypes.Remove(typeof(DeleteApplication));
            StackXAppHostBase.ExcludedAutoQueryTypes.Remove(typeof(QueryApplications));
            StackXAppHostBase.ExcludedAutoCrudTypes.Remove(typeof(CreateApplication));
        }
Exemplo n.º 13
0
        public void Register(IAppHost appHost)
        {
            var container  = appHost.GetContainer();
            var connection = container.Resolve <IDbConnectionFactory>();
            var db         = connection.CreateDbConnection();

            db.Open();
            db.CreateTableIfNotExists <File>();

            if (!db.ColumnExists <File>(c => c.ExtraAttribute1))
            {
                db.AddColumn <File>(c => c.ExtraAttribute1);
            }
            if (!db.ColumnExists <File>(c => c.ExtraAttribute2))
            {
                db.AddColumn <File>(c => c.ExtraAttribute2);
            }

            if (!db.ColumnExists <File>(c => c.ExtraAttribute3))
            {
                db.AddColumn <File>(c => c.ExtraAttribute3);
            }
            if (!db.ColumnExists <File>(c => c.ExtraAttribute4))
            {
                db.AddColumn <File>(c => c.ExtraAttribute4);
            }

            StackXAppHostBase.ExcludedAutoQueryTypes.Remove(typeof(QueryFiles));
            StackXAppHostBase.ExcludedAutoCrudTypes.Remove(typeof(UpdateFile));
            appHost.ServiceController.RegisterService(typeof(FileService));
        }
        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            if (container.Exists <IpModuleManager>())
            {
                var manager = container.Resolve <IpModuleManager>();

                manager.DeviceStatusChanged += (sender, args) =>
                {
                    logger.DebugFormat("{0}:{1}[{2}]", args.Device.Name, args.Device.Status, args.Device.ZoneId);
                    var settings = container.Resolve <SmartThingsSettings>();
                    var cb       = new SmartThingsCallbacks(settings);
                    cb.PutDeviceUpdate(args.Device);
                };

                manager.PartitionStatusChanged += (sender, args) =>
                {
                    logger.DebugFormat("{0}:{1}", args.Partition.Name, args.Partition.Status);
                    var settings = container.Resolve <SmartThingsSettings>();
                    var cb       = new SmartThingsCallbacks(settings);
                    cb.PutPartitionUpdate(args.Partition);
                };
            }
            else
            {
                logger.Error("Cannot find Ip Module Manager to register device and partition status changes events for SmartThings");
            }
        }
Exemplo n.º 15
0
        public static void ConfigureRepositories(this IAppHost appHost,
                                                 Assembly[] assembliesContainingDomainTypes)
        {
            var container = appHost.GetContainer();

            if (!container.Exists <IDependencyContainer>())
            {
                container.AddSingleton <IDependencyContainer>(new FunqDependencyContainer(container));
            }
            if (!container.Exists <IDomainFactory>())
            {
                container.AddSingleton <IDomainFactory>(c => DomainFactory.CreateRegistered(
                                                            c.Resolve <IDependencyContainer>(), assembliesContainingDomainTypes));
            }
            else
            {
                container.Resolve <IDomainFactory>()
                .RegisterDomainTypesFromAssemblies(assembliesContainingDomainTypes);
            }
            container.AddSingleton <IChangeEventMigrator>(c => new ChangeEventTypeMigrator());

            if (!container.Exists <IRepository>())
            {
                container.AddSingleton(GetRepository(appHost));
            }

            if (!container.Exists <IBlobository>())
            {
                container.AddSingleton(GetBlobository(appHost));
            }
        }
        public async void Register(IAppHost appHost)
        {
            appSettings = appHost.AppSettings ?? new AppSettings();

            var connectionSettings = GetConnectionSettings();

            var eventStoreConnection = connection ?? EventStoreConnection.Create(connectionSettings.GetConnectionString());

            await eventStoreConnection.ConnectAsync().ConfigureAwait(false); //no need for the initial synchronisation context

            //to be reused when executing the rest of the method

            new ConnectionMonitor(eventStoreConnection, connectionSettings.MonitorSettings)
            .AddHandlers();

            container = appHost.GetContainer();

            RegisterTypesForIoc(eventStoreConnection);

            appHost.GetPlugin <MetadataFeature>()?
            .AddPluginLink($"http://{connectionSettings.GetHttpEndpoint()}/", "EventStore");

            try
            {
                foreach (var subscription in subscriptionSettings.Subscriptions)
                {
                    var consumer = (StreamConsumer)container.TryResolve(consumers[subscription.GetType().Name]);
                    await consumer.ConnectToSubscription(subscription).ConfigureAwait(false);
                }
            }
            catch (Exception e)
            {
                log.Error(e);
            }
        }
Exemplo n.º 17
0
        public virtual void Register(IAppHost appHost)
        {
            ValidateCallbackRequirements(appHost);

            clientSecretStore = () => appHost.TryResolve <IClientSecretStore>() ?? new DefaultClientSecretStore(appSettings);

            var provider = ProviderFactory();

            appHost.LoadPlugin(
                new AuthFeature(() => new AuthUserSession(),
                                new IAuthProvider[]
            {
                provider
            },
                                GetProviderLoginUrl(appHost))
                );

            if (defaultServiceClient == null)
            {
                return;
            }

            appHost.GetContainer().Register <IServiceClient>(defaultServiceClient);
            appHost.GlobalRequestFilters.Add(ImpersonateServiceClient);
        }
Exemplo n.º 18
0
        public void Register(IAppHost appHost)
        {
            var container   = appHost.GetContainer();
            var appSettings = appHost.AppSettings;
            var connections = appSettings.Get <Dictionary <string, string> >("connectionStrings");

#if DEBUG
            var sentinelHosts = new[] { connections.GetValueOrDefault("Sentinel0"), connections.GetValueOrDefault("Sentinel1"), connections.GetValueOrDefault("Sentinel2") };
            var sentinel      = new RedisSentinel(sentinelHosts, masterName: appSettings.GetString("redis.mastername"))
            {
                RedisManagerFactory = (master, slaves) => new RedisManagerPool(master, new RedisPoolConfig()
                {
                    MaxPoolSize = 20
                }),
                HostFilter = host => "{0}?db=0".Fmt(host)
            };
            container.Register <IRedisClientsManager>(c => sentinel.Start());
#else
            var redisManager = new RedisManagerPool(connections.GetValueOrDefault("Sentinel0"), new RedisPoolConfig()
            {
                MaxPoolSize = 20,
            });
            container.Register <IRedisClientsManager>(c => redisManager);
#endif
        }
        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            if (container.Exists<IpModuleManager>())
            {
                var manager = container.Resolve<IpModuleManager>();

                manager.DeviceStatusChanged += (sender, args) =>
                {
                    logger.DebugFormat("{0}:{1}[{2}]", args.Device.Name, args.Device.Status, args.Device.ZoneId);
                    var settings = container.Resolve<SmartThingsSettings>();
                    var cb = new SmartThingsCallbacks(settings);
                    cb.PutDeviceUpdate(args.Device);
                };

                manager.PartitionStatusChanged += (sender, args) =>
                {
                    logger.DebugFormat("{0}:{1}", args.Partition.Name, args.Partition.Status);
                    var settings = container.Resolve<SmartThingsSettings>();
                    var cb = new SmartThingsCallbacks(settings);
                    cb.PutPartitionUpdate(args.Partition);
                };
            }
            else
            {
                logger.Error("Cannot find Ip Module Manager to register device and partition status changes events for SmartThings");
            }

        }
Exemplo n.º 20
0
        public void Register(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            if (!container.Exists <IServerEvents>())
            {
                var broker = new MemoryServerEvents
                {
                    IdleTimeout                  = IdleTimeout,
                    HouseKeepingInterval         = HouseKeepingInterval,
                    OnSubscribe                  = OnSubscribe,
                    OnUnsubscribe                = OnUnsubscribe,
                    NotifyChannelOfSubscriptions = NotifyChannelOfSubscriptions,
                    //OnError = OnError,
                };
                container.Register <IServerEvents>(broker);
            }

            appHost.RawHttpHandlers.Add(httpReq =>
                                        httpReq.PathInfo.EndsWith(StreamPath)
                    ? (IHttpHandler) new ServerEventsHandler()
                    : httpReq.PathInfo.EndsWith(HeartbeatPath)
                      ? new ServerEventsHeartbeatHandler()
                      : null);

            if (UnRegisterPath != null)
            {
                appHost.RegisterService(typeof(ServerEventsUnRegisterService), UnRegisterPath);
            }

            if (SubscribersPath != null)
            {
                appHost.RegisterService(typeof(ServerEventsSubscribersService), SubscribersPath);
            }
        }
Exemplo n.º 21
0
        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            if (container.Exists<IpModuleManager>())
            {
                var manager = container.Resolve<IpModuleManager>();

                manager.DeviceStatusChanged += (sender, args) =>
                {
                    var cb = container.Resolve<IParadoxEventCallbacks>();
                    cb.PutDeviceUpdate(args.Device);
                };

                manager.PartitionStatusChanged += (sender, args) =>
                {
                    var cb = container.Resolve<IParadoxEventCallbacks>();
                    cb.PutPartitionUpdate(args.Partition);
                };
            }
            else
            {
                logger.Error("Cannot find Ip Module Manager to register device and partition status changes events for MQTT");
            }
        }
Exemplo n.º 22
0
        public void AfterInit(IAppHost appHost)
        {
            if (EnableDeclarativeValidation)
            {
                var container       = appHost.GetContainer();
                var hasDynamicRules = ValidationSource != null || container.Exists <IValidationSource>();

                foreach (var op in appHost.Metadata.Operations)
                {
                    var hasValidateRequestAttrs = Validators.HasValidateRequestAttributes(op.RequestType);
                    if (hasValidateRequestAttrs)
                    {
                        Validators.RegisterRequestRulesFor(op.RequestType);
                        op.AddRequestTypeValidationRules(Validators.GetTypeRules(op.RequestType));
                    }

                    var hasValidateAttrs = Validators.HasValidateAttributes(op.RequestType);
                    if (hasDynamicRules || hasValidateAttrs)
                    {
                        container.RegisterNewValidatorIfNotExists(op.RequestType);
                        op.AddRequestPropertyValidationRules(Validators.GetPropertyRules(op.RequestType));
                    }
                }
            }
        }
Exemplo n.º 23
0
        public void Register(IAppHost appHost)
        {
            var broker = new MemoryServerEvents
            {
                Timeout       = Timeout,
                OnSubscribe   = OnSubscribe,
                OnUnsubscribe = OnUnsubscribe,
                NotifyChannelOfSubscriptions = NotifyChannelOfSubscriptions,
            };
            var container = appHost.GetContainer();

            if (container.TryResolve <IServerEvents>() == null)
            {
                container.Register <IServerEvents>(broker);
            }

            appHost.RawHttpHandlers.Add(httpReq =>
                                        httpReq.PathInfo.EndsWith(StreamPath)
                    ? (IHttpHandler) new ServerEventsHandler()
                    : httpReq.PathInfo.EndsWith(HeartbeatPath)
                      ? new ServerEventsHeartbeatHandler()
                      : null);

            if (UnRegisterPath != null)
            {
                appHost.RegisterService(typeof(ServerEventsUnRegisterService), UnRegisterPath);
            }

            if (SubscribersPath != null)
            {
                appHost.RegisterService(typeof(ServerEventsSubscribersService), SubscribersPath);
            }
        }
 protected void OnRegister(IAppHost appHost)
 {
     if (AccessRole != null && appHost.GetContainer().Exists <ICrudEvents>())
     {
         appHost.RegisterServices(ServiceRoutes);
     }
 }
Exemplo n.º 25
0
        /// <summary>
        /// Activate the validation mechanism, so every request DTO with an existing validator
        /// will be validated.
        /// </summary>
        /// <param name="appHost">The app host</param>
        public void Register(IAppHost appHost)
        {
            if (TreatInfoAndWarningsAsErrors)
            {
                if (!appHost.GlobalRequestFiltersAsync.Contains(ValidationFilters.RequestFilterAsync))
                {
                    appHost.GlobalRequestFiltersAsync.Add(ValidationFilters.RequestFilterAsync);
                }

                if (!appHost.GlobalMessageRequestFiltersAsync.Contains(ValidationFilters.RequestFilterAsync))
                {
                    appHost.GlobalMessageRequestFiltersAsync.Add(ValidationFilters.RequestFilterAsync);
                }
            }
            else
            {
                if (!appHost.GlobalRequestFiltersAsync.Contains(ValidationFilters.RequestFilterAsyncIgnoreWarningsInfo))
                {
                    appHost.GlobalRequestFiltersAsync.Add(ValidationFilters.RequestFilterAsyncIgnoreWarningsInfo);
                }

                if (!appHost.GlobalMessageRequestFiltersAsync.Contains(ValidationFilters.RequestFilterAsyncIgnoreWarningsInfo))
                {
                    appHost.GlobalMessageRequestFiltersAsync.Add(ValidationFilters.RequestFilterAsyncIgnoreWarningsInfo);
                }

                if (!appHost.GlobalResponseFiltersAsync.Contains(ValidationFilters.ResponseFilterAsync))
                {
                    appHost.GlobalResponseFiltersAsync.Add(ValidationFilters.ResponseFilterAsync);
                }

                if (!appHost.GlobalMessageResponseFiltersAsync.Contains(ValidationFilters.ResponseFilterAsync))
                {
                    appHost.GlobalMessageResponseFiltersAsync.Add(ValidationFilters.ResponseFilterAsync);
                }
            }

            if (ValidationSource != null)
            {
                appHost.Register(ValidationSource);
                ValidationSource.InitSchema();
            }

            var container           = appHost.GetContainer();
            var hasValidationSource = ValidationSource != null || container.Exists <IValidationSource>();

            if (hasValidationSource && AccessRole != null)
            {
                foreach (var registerService in ServiceRoutes)
                {
                    appHost.RegisterService(registerService.Key, registerService.Value);
                }
            }

            if (ScanAppHostAssemblies)
            {
                container.RegisterValidators(((ServiceStackHost)appHost).ServiceAssemblies.ToArray());
            }
        }
Exemplo n.º 26
0
        public void Register(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            RegisterSubscriptionStore(container);
            RegisterSubscriptionService(appHost);
            RegisterClient(container);
        }
 public void Configure(IAppHost appHost)
 {
     var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
     var mySettings = settingsProvider.GetSettings<SmartThingsSettings>();
     var container = appHost.GetContainer();
     container.Register(mySettings);
     container.RegisterAs<SmartThingsCallbacks, IParadoxEventCallbacks>();
 }
        public void Configure(IAppHost appHost)
        {
            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
            var mySettings       = settingsProvider.GetSettings <SmartThingsSettings>();
            var container        = appHost.GetContainer();

            container.Register(mySettings);
            container.RegisterAs <SmartThingsCallbacks, IParadoxEventCallbacks>();
        }
Exemplo n.º 29
0
 // constructor with event handlers
 public RealEstateServicesData(IAppHost appHost, ConcurrentObservableDictionary <string, decimal> pluginRootCOD, NotifyCollectionChangedEventHandler onPluginRootCODCollectionChanged, PropertyChangedEventHandler onPluginRootCODPropertyChanged)
 {
     cacheClient   = appHost.GetContainer().Resolve <ICacheClient>();
     PluginRootCOD = pluginRootCOD;
     this.onPluginRootCODCollectionChanged = onPluginRootCODCollectionChanged;
     this.onPluginRootCODPropertyChanged   = onPluginRootCODPropertyChanged;
     pluginRootCOD.CollectionChanged      += this.onPluginRootCODCollectionChanged;
     pluginRootCOD.PropertyChanged        += this.onPluginRootCODPropertyChanged;
 }
Exemplo n.º 30
0
 public void Configure(IAppHost appHost)
 {
     var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
     var mySettings = settingsProvider.GetSettings<ParadoxMqttSettings>();
     var container = appHost.GetContainer();
     container.Register(mySettings);
     container.Register(new MqttClient(mySettings.BrokerUrl));
     container.RegisterAs<MqttCallbacks, IParadoxEventCallbacks>().ReusedWithin(ReuseScope.Container);
 }
Exemplo n.º 31
0
        public void Configure(IAppHost appHost)
        {
            var settingsProvider = new SettingsProvider(new RoamingAppDataStorage("Paradox"));
            var mySettings       = settingsProvider.GetSettings <ParadoxMqttSettings>();
            var container        = appHost.GetContainer();

            container.Register(mySettings);
            container.Register(new MqttClient(mySettings.BrokerUrl));
            container.RegisterAs <MqttCallbacks, IParadoxEventCallbacks>().ReusedWithin(ReuseScope.Container);
        }
        public void Configure(IAppHost appHost)
        {
            appHost.GetContainer().AddSingleton <IAuthRepository>(c =>
                                                                  new InMemoryAuthRepository <AppUser, UserAuthDetails>());
            var authRepo = appHost.Resolve <IAuthRepository>();

            authRepo.InitSchema();

            CreateUser(authRepo, "*****@*****.**", "Admin User", "p@55wOrd", roles: new[] { RoleNames.Admin });
        }
Exemplo n.º 33
0
        public static void ConfigureRequestValidation(this IAppHost appHost,
                                                      Assembly[] assembliesContainingServicesAndDependencies)
        {
            var container = appHost.GetContainer();

            appHost.Plugins.AddIfNotExists(new ValidationFeature());
            container.RegisterValidators(assembliesContainingServicesAndDependencies);
            container.AddSingleton <IHasSearchOptionsValidator, HasSearchOptionsValidator>();
            container.AddSingleton <IHasGetOptionsValidator, HasGetOptionsValidator>();
        }
Exemplo n.º 34
0
        public static void Configure(IAppHost appHost)
        {
            JsConfig.EmitCamelCaseNames = true;

            RedisConfig.AssumeServerVersion = 2821;

            var container = appHost.GetContainer();
            container.Register<IRedisClientsManager>(c =>
                new RedisManagerPool(appHost.AppSettings.Get("redis-server", "127.0.0.1")));
        }
        private void RegisterService(IAppHost host)
        {
            ServiceDiscovery = Settings.GetDiscoveryClient() ?? new ConsulDiscovery();
            ServiceDiscovery.Register(host);

            // register servicestack discovery services
            host.Register(ServiceDiscovery);
            host.GetContainer()
                .Register<IServiceGatewayFactory>(x => new ConsulServiceGatewayFactory(Settings.GetGateway(), ServiceDiscovery))
                .ReusedWithin(ReuseScope.None);
        }
Exemplo n.º 36
0
        public static void Configure(IAppHost appHost)
        {
            appHost.Config.UseCamelCase = true;

            RedisConfig.AssumeServerVersion = 2821;

            var container = appHost.GetContainer();

            container.Register <IRedisClientsManager>(c =>
                                                      new RedisManagerPool(appHost.AppSettings.Get("redis-server", "127.0.0.1")));
        }
        private void RegisterService(IAppHost host)
        {
            ServiceDiscovery = Settings.GetDiscoveryClient() ?? new ConsulDiscovery();
            ServiceDiscovery.Register(host);

            // register servicestack discovery services
            host.Register(ServiceDiscovery);
            host.GetContainer()
            .Register <IServiceGatewayFactory>(x => new ConsulServiceGatewayFactory(Settings.GetGateway(), ServiceDiscovery))
            .ReusedWithin(ReuseScope.None);
        }
Exemplo n.º 38
0
        public void Register(IAppHost appHost)
        {
            appHost.RegisterService<Account.Service>();
            appHost.RegisterService<Currency.Service>();

            //appHost.GetContainer().RegisterAutoWiredType(typeof(Users.Service));

            //var container = appHost.GetContainer().Resolve<SimpleInjector.Container>();
            //container.RegisterManyForOpenGeneric(typeof(IQueryHandler<,>), typeof(Plugin).Assembly);
            //container.RegisterManyForOpenGeneric(typeof(IPagingQueryHandler<,>), typeof(Plugin).Assembly);

            //appHost.GetContainer().Register<Users.Service>((c) => new Users.Service(c.Resolve<IBus>()));
            appHost.GetContainer().RegisterValidators(typeof(Plugin).Assembly);
        }
        public void Register(IAppHost appHost)
        {
            var container = appHost.GetContainer();

            container.Register(c => appHost);
            container.Register<IRedisClientsManager>(new PooledRedisClientManager("localhost:6379"));
            container.Register(container.Resolve<IRedisClientsManager>().GetClient());

            var redisVirtualPathProvider = new RedisVirtualPathProvider(appHost);

            container.Register(c => redisVirtualPathProvider);
            container.RegisterAutoWired<RedisVirtualPathProvider>().ReusedWithin(ReuseScope.Default);
            //container.RegisterAutoWiredType(typeof(RedisVirtualPathProvider), ReuseScope.Default);
            //container.AutoWire(redisVirtualPathProvider);
            
            
            var clientManager = container.Resolve<IRedisClientsManager>();
            var redisClient = container.Resolve<IRedisClient>();
            var pathProvider = container.Resolve<RedisVirtualPathProvider>();
            
            ;
        }
        public void Register(IAppHost appHost)
        {
            var broker = new MemoryServerEventsBroker()
            {
                //Timeout = Timeout,
            };

            var container = appHost.GetContainer();

            if (container.TryResolve<IServerEventsBroker>() == null)
                container.Register<IServerEventsBroker>(broker);

            appHost.RawHttpHandlers.Add(httpReq =>
                httpReq.PathInfo.EndsWith(StreamPath)
                    ? (IHttpHandler)new ServerEventsHandler()
                    //: httpReq.PathInfo.EndsWith(HeartbeatPath)
                    //  ? new ServerEventsHeartbeatHandler()
                      : null);
        }
Exemplo n.º 41
0
        public void AfterPluginsLoaded(IAppHost appHost)
        {
            var authEvents = appHost.TryResolve<IAuthEvents>();
            if (authEvents == null)
            {
                authEvents = AuthEvents.Count == 0
                    ? new AuthEvents() :
                      AuthEvents.Count == 1
                    ? AuthEvents.First()
                    : new MultiAuthEvents(AuthEvents);

                appHost.GetContainer().Register<IAuthEvents>(authEvents);
            }
            else if (AuthEvents.Count > 0)
            {
                throw new Exception("Registering IAuthEvents via both AuthFeature.AuthEvents and IOC is not allowed");
            }
        }