Esempio n. 1
0
        public void RegisterIn(IObjectAssemblyRegistry registry)
        {
            // register configuration
            registry.Register <IConfig>(SpecialFactoryContexts.Safe, _ => new ApplicationConfiguration());
            registry.Register <IConfig>(
                factory =>
                new AggregateConfiguration(
                    new TorrentConfiguration(),
                    new AssemblyAttributeConfiguration(),
                    factory.Resolve <IConfig>(SpecialFactoryContexts.Safe),
                    new ResourcesConfiguration()));

            registry.Register <ITrackerFactory>(_ => new TrackerFactory());
            registry.Register <ITorrentClientManager>(_ => new TorrentClientManager());
        }
Esempio n. 2
0
        public void RegisterIn(IObjectAssemblyRegistry registry)
        {
            // config
            registry.Register <IConfig>(_ => new ApplicationConfiguration()).AsAssemblerSingleton();

            // string resources cache
            registry.Register <StringResourcesCache>(_ => new StringResourcesCache()).AsAssemblerSingleton();

            // application alert
            registry.Register <IApplicationAlert>(_ => new AppEventLogApplicationAlert());

            // file mirror
            registry.Register <ILocalFileMirror>(_ => new CentralFileMirror());

            // host environment
            registry.Register <IHostEnvironment>(_ => new DataCenterHostEnvironment());

            // workspace
            registry.Register <IWorkspace>("Workflow", _ => new MemoryWorkspace());

            // scheduler, job work
            registry.Register <IJobScheduler>(_ => new InMemoryJobScheduler());

            // distributed mutex
            registry.Register <IDistributedMutex>(_ => new DevolvedDistributedMutex());

            // message bus
            registry.Register <IMessageBusSpecifier>("Workflow", _ => MemMessageBus.Instance());
            registry.Register <IMessagePublisher>("Workflow", _ => new MemMessagePublisher());
            registry.Register <IMessageListener>("Workflow", _ => new MemMessageListener());


            // blob
            registry.Register <IFilesContainer>(_ => new FileStoreBlobFileContainer());

            // data repository
            registry.Register("Workflow", typeof(IDataRepositoryService <, , , , ,>), typeof(InMemoryDataRepositoryService <, , , , ,>));


            // workflow
            registry.Register <IWorkflowCatalog>(
                _ => Catalog.Preconfigure()
                .Add(WorkflowConfiguration.WorkflowDataRepositoryKey, "Workflow")
                .Add(WorkflowConfiguration.WorkflowMessagingKey, "Workflow")
                .Add(WorkflowConfiguration.WorkflowWorkspaceKey, "Workflow")
                .ConfiguredCreate(() => new WorkflowCatalog()));
        }
Esempio n. 3
0
        public void RegisterIn(IObjectAssemblyRegistry registry)
        {
            // register configuration
            registry.Register <IConfig>(SpecialFactoryContexts.Safe, _ => new ApplicationConfiguration());
            registry.Register <IConfig>(
                factory =>
                new AggregateConfiguration(
                    new WebEmailConfiguration(),
                    new AssemblyAttributeConfiguration(),
                    new AppComponents.DocumentStoreConfigurationService(
                        factory.Resolve <IConfig>(SpecialFactoryContexts.Safe)),
                    factory.Resolve <IConfig>(SpecialFactoryContexts.Safe),
                    new ResourcesConfiguration()));

            //Context Providers
            registry.Register <IContextProvider>(
                PrincipalTenancyContextProviderConfiguration.PrincipalContextFactoryKey,
                _ => new WebPrincipalContextProvider());

            registry.Register <IContextProvider>(
                //NamedRegistrations.TenancyContext, _ => new PrincipalTenancyContextProvider<ApplicationUser>());
                NamedRegistrations.TenancyContext, _ => new TenancyContextProvider());

            registry.Register <IContextProvider>(
                NamedRegistrations.RequestCulture, _ => new RequestCultureContextProvider());

            registry.Register <IContextProvider>(
                NamedRegistrations.ApplicationType, _ => new ApplicationTypeContextProvider());


            registry.Register <IReportDataStorage>(_ => new FileReportDataStorage()).AsAssemblerSingleton();

            //Generic file types
            registry.Register(typeof(IBlobContainer <>), typeof(FileStoreBlobContainer <>));

            //File container
            registry.Register <IFilesContainer>(_ => new FileStoreBlobFileContainer());

            registry.Register <IDistributedMutex>(_ => new DocumentDistributedMutex());

            //smtp email settings
            registry.Register <IMessagePublisher>(_ => new SMTPMessagePublisher());
            registry.Register <IBlobContainer <EmailTemplate> >(_ => new FileStoreBlobContainer <EmailTemplate>());

            //Register for Alerts Log
            registry.Register <IApplicationAlert>(_ => new AppEventLogApplicationAlert());
        }
Esempio n. 4
0
        public void RegisterIn(IObjectAssemblyRegistry registry)
        {
            // register configuration
            log4net.Config.XmlConfigurator.Configure();
            var log = LogManager.GetLogger(GetType());

            try
            {
                registry.Register <IRecurrence <object> >(_ => new WebRecurrence <object>());
                var globalConfig =
                    Catalog.Preconfigure().Add(ApplicationTopologyLocalConfig.CompanyKey, TopologyPath.Company).Add(
                        ApplicationTopologyLocalConfig.ApplicationKey, TopologyPath.Product).ConfiguredCreate(
                        () => new RavenGlobalConfig());

                registry.Register <IConfig>(
                    _ =>
                    new AggregateConfiguration(globalConfig, new ApplicationConfiguration())).AsAssemblerSingleton();

                registry.Register <IConfig>(SpecialFactoryContexts.Safe, _ => globalConfig);


                globalConfig.Start();


                //Context Providers
                registry.Register <IContextProvider>(
                    PrincipalTenancyContextProviderConfiguration.PrincipalContextFactoryKey,
                    _ => new WebPrincipalContextProvider());

                registry.Register <IContextProvider>(
                    NamedRegistrations.TenancyContext, _ => new PrincipalTenancyContextProvider <ApplicationUser>());

                registry.Register <IContextProvider>(
                    NamedRegistrations.RequestCulture, _ => new RequestCultureContextProvider());

                registry.Register <IContextProvider>(
                    NamedRegistrations.ApplicationType, _ => new ApplicationTypeContextProvider());


                registry.Register <IReportDataStorage>(_ => new FileReportDataStorage()).AsAssemblerSingleton();

                //Generic file types
                registry.Register(typeof(IBlobContainer <>), typeof(FileStoreBlobContainer <>));

                //File container
                registry.Register <IFilesContainer>(_ => new FileStoreBlobFileContainer());

                registry.Register <IDistributedMutex>(_ => new DocumentDistributedMutex());

                //smtp email settings
                registry.Register <IMessagePublisher>(_ => new SMTPMessagePublisher());
                registry.Register <IBlobContainer <EmailTemplate> >(_ => new FileStoreBlobContainer <EmailTemplate>());

                registry.Register <IApplicationNodeGatherer>(
                    _ =>
                {
                    var retval = new PerfCounterGatherer(TopologyPath.Company, TopologyPath.Product);
                    StdPerfCounters.LoadCLRPerfCounters(retval);
                    StdPerfCounters.LoadASPPerfCounters(retval);
                    return(retval);
                }).AsAssemblerSingleton();

                registry.Register <IApplicationAlert>(
                    _ => (IApplicationAlert)Catalog.Factory.Resolve <IApplicationNodeGatherer>());

                var appReg = new ApplicationNodeRegistry(TopologyPath.Company, TopologyPath.Product);

                registry.Register <IApplicationNodeRunner>(
                    _ => Catalog.Preconfigure().Add(
                        ApplicationTopologyLocalConfig.CompanyKey, TopologyPath.Company).Add(
                        ApplicationTopologyLocalConfig.ApplicationKey, TopologyPath.Product).Add(
                        ApplicationTopologyLocalConfig.ComponentType, appReg.ComponentType).Add(
                        ApplicationTopologyLocalConfig.LogFilePath, "C:\\AppData\\Logs").
                    ConfiguredCreate(() => new RavenApplicationNodeRunner())).AsAssemblerSingleton();

                registry.Register <IApplicationTopologyManager>(_ => new RavenTopologyManager());

                registry.Register <ITimeZoneService>(_ => new HttpTimeZoneService());
            }
            catch (Exception ex)
            {
                //log the exception
                log.ErrorFormat("TRACE: {0}", ex.TraceInformation());
                throw;
            }
        }