/// <summary>
 ///     Registers the class map.
 /// </summary>
 /// <param name="map">The class map to register.</param>
 public virtual void RegisterClassMap(CsvClassMap map)
 {
     map.CreateMap();
     if (map.Constructor == null && map.PropertyMaps.Count == 0 && map.ReferenceMaps.Count == 0)
     {
         throw new CsvConfigurationException("No mappings were specified in the CsvClassMap.");
     }
     Maps.Add(map);
 }
Example #2
0
        /// <summary>
        /// Maps a property to another class map.
        /// </summary>
        /// <param name="map">Instance map</param>
        /// <param name="expression">The expression.</param>
        /// <returns>The reference mapping for the property</returns>
        protected virtual CsvPropertyReferenceMap References(CsvClassMap map, Expression <Func <T, object> > expression)
        {
            var property = ReflectionHelper.GetProperty(expression);

            map.CreateMap();
            map.ReIndex(GetMaxIndex() + 1);
            var reference = new CsvPropertyReferenceMap(property, map);

            ReferenceMaps.Add(reference);
            return(reference);
        }