Ejemplo n.º 1
0
        /// <summary>
        /// Create a new <see cref="CacheInvalidator{TKey, TValue}"/>.
        /// </summary>
        /// <param name="cache">
        /// The cache to invalidate. This cannot be null.
        /// </param>
        /// <param name="name">
        /// A unique name for the cache. This cannot be null, empty or whitespace.
        /// </param>
        /// <param name="traceCacheInvalidationSetting">
        /// An optional factory method that reads the <see cref="TraceCacheInvalidations"/> flag
        /// from the config file.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// No argument can be null.
        /// </exception>
        protected internal CacheInvalidator(ICache <TKey, TValue> cache, string name,
                                            Func <bool> traceCacheInvalidationSetting = null)
        {
            if (cache == null)
            {
                throw new ArgumentNullException("cache");
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name");
            }

            Cache                      = cache;
            EntityToCacheKey           = new BidirectionalMultidictionary <long, TKey>();
            FieldTypeToCacheKey        = new BidirectionalMultidictionary <long, TKey>();
            RelationshipTypeToCacheKey = new BidirectionalMultidictionary <long, TKey>();
            EntityInvalidatingRelationshipTypesToCacheKey = new BidirectionalMultidictionary <long, TKey>();
            EntityTypeToCacheKey = new BidirectionalMultidictionary <long, TKey>();
            Name = name;
            TraceCacheInvalidationFactory = traceCacheInvalidationSetting ?? (() => ConfigurationSettings.GetServerConfigurationSection().Security.CacheTracing);
            _tenantFieldIsOnTypeMap       = new ConcurrentDictionary <long, EntityRef>();
            DebugInvalidations            = new HashSet <TKey>( );

            Cache.ItemsRemoved += CacheOnItemsRemoved;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Return true if we can execute the remote code, false otherwise.
        /// </summary>
        /// <returns></returns>
        private bool CanExecute()
        {
            if (!string.IsNullOrWhiteSpace(Target) &&
                string.Compare(Target, Dns.GetHostEntry(Dns.GetHostName()).HostName, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(false);
            }

            return(ConfigurationSettings.GetServerConfigurationSection( ).RemoteExec.Enabled);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Returns the ReadiNow product installation date.
        /// </summary>
        /// <returns></returns>
        public static DateTime GetReadiNowProductInstallationDate()
        {
            DateTime dt;

            if (!DateTime.TryParse(ConfigurationSettings.GetServerConfigurationSection( ).SystemInfo.ActivationDate, out dt))
            {
                dt = DateTime.MinValue;
            }

            return(dt);
        }
Ejemplo n.º 4
0
 /// <summary>
 ///     Perform any registrations
 /// </summary>
 /// <param name="builder">The autofac container builder.</param>
 protected override void Load(ContainerBuilder builder)
 {
     // Register file repositories
     builder.Register(c =>
                      new FtpFileFetcher(
                          ConfigurationSettings.GetServerConfigurationSection( ).Security.FtpBypassSslCertificateCheck,
                          new SftpFileFetcher(),
                          new FtpsFileFetcher()
                          )
                      )
     .As <IRemoteFileFetcher>( )
     .SingleInstance( );
 }
Ejemplo n.º 5
0
        public void Test_GetTraceCacheInvalidationSetting()
        {
            bool oldSetting;
            bool newSetting;
            CacheInvalidator <int, int> cacheInvalidator;

            oldSetting = ConfigurationSettings.GetServerConfigurationSection().Security.CacheTracing;
            try
            {
                newSetting = !oldSetting;
                ConfigurationSettings.GetServerConfigurationSection().Security.CacheTracing = newSetting;

                cacheInvalidator = new CacheInvalidator <int, int>(new DictionaryCache <int, int>(), "Test");

                Assert.That(cacheInvalidator.TraceCacheInvalidations, Is.EqualTo(newSetting));
            }
            finally
            {
                ConfigurationSettings.GetServerConfigurationSection().Security.CacheTracing = oldSetting;
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Checks if the process monitor is enabled in the configuration file.
 /// </summary>
 /// <returns></returns>
 private static bool GetProcMonWriterEnabledRegValue()
 {
     return(ConfigurationSettings.GetServerConfigurationSection( ).ProcessMonitor.Enabled);
 }
Ejemplo n.º 7
0
 private static string GetRequiredClientVersion()
 {
     return(ConfigurationSettings.GetServerConfigurationSection().Client.GetMinClientVersion(SystemInfo.PlatformVersion));
 }