Example #1
0
 public ExtensionSettings(IOrganizationService OrgService, IXrmCache cache, IEncryption encryption, IExtensionSettingsConfig config)
 {
     try
     {
         if (OrgService == null)
         {
             throw new ArgumentNullException("OrgService is required.");
         }
         if (cache == null)
         {
             throw new ArgumentNullException("cache is required.");
         }
         if (config == null)
         {
             throw new ArgumentNullException("config is required.");
         }
         if (encryption == null)
         {
             throw new ArgumentNullException("encryption is required.");
         }
         this.config     = config;
         this.orgService = OrgService;
         this.cache      = cache;
         this.encryption = encryption;
         encryptionKey   = !string.IsNullOrEmpty(config.EncryptionKey) ? config.EncryptionKey : DEFAULT_ENCRYPTION_KEY;
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("Error constructing ExtensionSettings: {0}", ex.Message), ex);
     }
 }
 public IExtensionSettings BuildExtensionSettings(IOrganizationService orgService, IXrmCache cache, IEncryption encryption, IExtensionSettingsConfig config)
 {
     return(new ExtensionSettings(orgService, cache, encryption, config));
 }