internal static FieldDescriptor GetFieldDescriptor(string fieldId, IDictionary <string, FieldDescriptor> customFields, UndefinedCustomFieldHandling undefinedCustomFieldHandling) { Preconditions.NotNullOrEmpty(fieldId, nameof(fieldId)); if (!FieldMappings.TryGetDescriptor(fieldId, out var descriptor) && customFields?.TryGetValue(fieldId, out descriptor) != true && (!FieldPatternMappings.TryGetDescriptorForFieldId(fieldId, out descriptor) || (descriptor.Type == LoanFieldType.Custom && (undefinedCustomFieldHandling == UndefinedCustomFieldHandling.Error || (undefinedCustomFieldHandling == UndefinedCustomFieldHandling.ErrorIfCustomFieldsInitialized && (customFields?.Count ?? 0) != 0))))) { throw new ArgumentException($"Could not find field '{fieldId}'"); } return(descriptor); }
internal static FieldDescriptor GetFieldDescriptor(string fieldId, IDictionary <string, FieldDescriptor> customFields) { Preconditions.NotNullOrEmpty(fieldId, nameof(fieldId)); if (!FieldMappings.TryGetDescriptor(fieldId, out var descriptor) && customFields?.TryGetValue(fieldId, out descriptor) != true && !FieldPatternMappings.TryGetDescriptorForFieldId(fieldId, out descriptor)) { throw new ArgumentException($"Could not find field '{fieldId}'"); } return(descriptor); }