Ejemplo n.º 1
0
 public CmsItemStorageService(AzureStorageService azureStorageService, AzureTableService tableService, IOptions <CmsConfiguration> cmsConfiguration, IOptions <AzureStorageConfig> azureStorageConfig)
 {
     this.azureStorageService = azureStorageService;
     this.tableService        = tableService;
     this.cmsConfiguration    = cmsConfiguration.Value;
     this.azureStorageConfig  = azureStorageConfig.Value;
 }
Ejemplo n.º 2
0
        public DatabaseSynchronizer(
            IConfigurationStore configurationStore,
            IContextFactory contextFactory,
            ICommandFactory commandFactory)
        {
            _contextFactory = contextFactory;
            _commandFactory = commandFactory;

            _configReg = configurationStore.Register(
                CmsConfiguration.Path,
                c => _configuration = c,
                new CmsConfiguration());

            _lastMessageId    = GetLastMessageId();
            _idlePollInterval = TimeSpan.FromSeconds(5);

            _sentMessagesCurrent = new HashSet <string>();
            _sentMessagesPrior   = new HashSet <string>();
            _hashSetSwapMinutes  = 5;
            _nextHashSetSwap     = DateTime.UtcNow.AddMinutes(_hashSetSwapMinutes);

            _subscribers = new ILiveUpdateRecipient[0];

            _pollingThread = new Thread(PollThreadEntry)
            {
                Name         = "Poll change events",
                IsBackground = true,
                Priority     = ThreadPriority.BelowNormal
            };

            _pollingThread.Start();
        }
Ejemplo n.º 3
0
        public static bool SetValue(this IRepository <CmsConfiguration> repository, string Name, string Value)
        {
            if (repository is null)
            {
                return(false);
            }
            else
            {
                using (IWriteContext context = repository.WriteContext())
                {
                    CmsConfiguration existing = repository.FirstOrDefault(c => c.Name == Name);

                    if (existing is null)
                    {
                        repository.Add(new CmsConfiguration()
                        {
                            Name  = Name,
                            Value = Value
                        });
                    }
                    else if (existing.Value != Value)
                    {
                        existing.Value = Value;
                        repository.Update(existing);
                    }
                }

                return(true);
            }
        }
Ejemplo n.º 4
0
 public static void AddStaticContentSupport(this CmsConfiguration cmsConfiguration)
 {
     cmsConfiguration.AddRenderingEngineSupport(new RenderingEngineSupport
     {
         FragmentRenderer       = typeof(StaticContentRenderer),
         PageCompositionFactory = typeof(StaticContentPageElementFactory)
     });
 }
 public static void AddWebFormsSupport(this CmsConfiguration cmsConfiguration)
 {
     cmsConfiguration.AddRenderingEngineSupport(new RenderingEngineSupport
     {
         FragmentRenderer       = typeof(WebFormsFragmentRenderer),
         PageCompositionFactory = typeof(WebFormsPageCompositionElementFactory)
     });
 }
        private static ICmsConfiguration appSettingRead()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddEnvironmentVariables();

            Config = builder.Build();
            #region appsetting Read
            var cmsConfiguration = new CmsConfiguration();
            cmsConfiguration.VerConfig = "Wellecom ver: 1 Worker.WorkerService  Now:( " + DateTime.Now + " )";
            Config.Bind("AppSettings", cmsConfiguration.AppSettings);
            Config.Bind("ConnectionStrings", cmsConfiguration.ConnectionStrings);
            cmsConfiguration.AppMemory.WebRootPath     = Config["Application:WebRootPath"];
            cmsConfiguration.AppMemory.ContentRootPath = Config["Application:ContentRootPath"];

            #endregion appsetting Read

            return(cmsConfiguration);
        }
Ejemplo n.º 7
0
        public CmsItemStorageService(IOptions <SkynetConfig> skynetConfig, IOptions <CmsConfiguration> cmsConfiguration)
        {
            this.skynetConfig     = skynetConfig.Value;
            this.cmsConfiguration = cmsConfiguration.Value;

            if (!string.IsNullOrEmpty(skynetConfig.Value.BaseUrl))
            {
                _client = new SiaSkynetClient(skynetConfig.Value.BaseUrl);
            }
            else
            {
                _client = new SiaSkynetClient();
            }

            if (string.IsNullOrWhiteSpace(this.skynetConfig.Secret))
            {
                throw new ArgumentNullException("SkynetConfig.Seed should contain a seed value to generate a private/public key pair.", nameof(skynetConfig));
            }

            var keypair = SiaSkynetClient.GenerateKeys(this.skynetConfig.Secret);

            privateKey = keypair.privateKey;
            publicKey  = keypair.publicKey;
        }
Ejemplo n.º 8
0
 public JsonSchemaService(IOptions <CmsConfiguration> cmsConfiguration, IHttpClientFactory clientFactory, ILoggerFactory loggerFactory)
 {
     this.cmsConfiguration = cmsConfiguration.Value;
     this.clientFactory    = clientFactory;
     this.logger           = loggerFactory.CreateLogger <JsonSchemaService>();
 }
Ejemplo n.º 9
0
 private void ConfigurationChanged(CmsConfiguration configuration)
 {
     _configuration = configuration;
 }
Ejemplo n.º 10
0
 public CosmosService(IOptions <CosmosConfig> cosmosConfig, IOptions <CmsConfiguration> cmsConfiguration)
 {
     this.cosmosConfig     = cosmosConfig.Value;
     this.cmsConfiguration = cmsConfiguration.Value;
 }