示例#1
0
        public LocalStorage(LocalStorageConfiguration configuration, string encryptionKey)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _config = configuration;

            if (_config.EnableEncryption)
            {
                if (string.IsNullOrEmpty(encryptionKey))
                {
                    throw new ArgumentNullException(nameof(encryptionKey), "When EnableEncryption is enabled, an encryptionKey is required when initializing the LocalStorage.");
                }
                _encryptionKey = encryptionKey;
            }

            if (_config.AutoLoad)
            {
                Load();
            }
        }
示例#2
0
 public LocalStorage(LocalStorageConfiguration configuration) : this(configuration, string.Empty)
 {
 }