/// <summary> /// Add a type with and a list og MappingAttributes to register this type as an mapping for read and write operations /// </summary> /// <param name="type">Could be any type</param> /// <param name="mappingAttributes">mappings to add</param> /// <returns></returns> public bool AddMapping(Type type, params MappingAttribute[] mappingAttributes) { if (type == null) { ExceptionThrowHelper.ThrowArgumentNullException <Type>(nameof(type)); } if (!mappingAttributes.Any()) { ExceptionThrowHelper.ThrowMappingAttributeNotFoundForTypeException(type); } return(AddMappingsInternal(type, mappingAttributes)); }
/// <summary> /// Add a type with an MappingAttribute to register this type as an mapping for read and write operations /// </summary> /// <param name="type">Has to be a type with at least one MappingAttribute</param> /// <returns></returns> public bool AddMapping(Type type) { if (type == null) { ExceptionThrowHelper.ThrowArgumentNullException <Type>(nameof(type)); } var mappingAttributes = type.GetTypeInfo().GetCustomAttributes <MappingAttribute>().ToList(); if (!mappingAttributes.Any()) { ExceptionThrowHelper.ThrowMappingAttributeNotFoundForTypeException(type); } return(AddMappingsInternal(type, mappingAttributes)); }