コード例 #1
0
        private TType createInstance(IDataRecord record)
        {
            TType instance = factory();

            for (int index = 0; index != columns.Count; ++index)
            {
                CustomColumnConfiguration configuration = columns[index];
                object value = record.GetValue(index);
                configuration.Property.SetValue(instance, value, null);
            }
            return(instance);
        }
コード例 #2
0
        /// <summary>
        /// Maps the property to the column with the given name.
        /// </summary>
        /// <param name="columnName">The name of the column.</param>
        /// <returns>A class that allows a different converter to be specified.</returns>
        public Mapper <TType> To(string columnName)
        {
            if (String.IsNullOrWhiteSpace(columnName))
            {
                throw new ArgumentException(Resources.BlankColumnName, "columnName");
            }
            CustomColumnConfiguration configuration = builder.FindConfiguration(property.Name);

            if (configuration == null)
            {
                configuration          = new CustomColumnConfiguration();
                configuration.Property = property;
                builder.AddConfiguration(configuration);
            }
            configuration.ColumnName = columnName;
            return(builder);
        }
コード例 #3
0
 /// <summary>
 /// Maps the property returned by the selector to the column with the given name.
 /// </summary>
 /// <param name="configuration">The next configuration to add to the schema.</param>
 /// <returns>The schema builder.</returns>
 internal void AddConfiguration(CustomColumnConfiguration configuration)
 {
     columns.Add(configuration);
 }