/// <summary> /// Returns the OptionMetadataCollection for a global option set /// </summary> /// <param name="settings">The settings.</param> /// <param name="optionSetName">Name of the option set.</param> /// <returns></returns> public static OptionMetadataCollection GetOptionSet(this CrmService settings, string optionSetName) { string key = GetOptionSetKey(GetServiceKey(settings), optionSetName); OptionMetadataCollection options; if (_optionSets.TryGetValue(key, out options)) { return(options); } else { using (var service = CrmService.CreateOrgProxy(settings)) { return(GetOptionSet(service, optionSetName)); } } }
/// <summary> /// Creates an OrganizationServiceProxy. This should always be wrapped in a using statement so the dispose method is called. /// </summary> /// <returns></returns> public static OrganizationServiceProxy CreateOrgProxy() { return(CrmService.CreateOrgProxy(CrmService.CreateCrmService())); }