本文整理汇总了C#中Mapping.Map方法的典型用法代码示例。如果您正苦于以下问题:C# Mapping.Map方法的具体用法?C# Mapping.Map怎么用?C# Mapping.Map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapping
的用法示例。
在下文中一共展示了Mapping.Map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterMapping
public void RegisterMapping(ICompilerInputContract contract, ICompilerInputContractMapping dataRowContractMapping)
{
var properties = contract.Properties.Select(p => new CompilerInputContractProperty(p)).ToList();
var fieldMappings = dataRowContractMapping.Mapping.ToList();
var ixPropertyNames = new HashSet<string>(this.m_columnInfos.Select(c => c.ColumnName), StringComparer.OrdinalIgnoreCase);
//if (fieldMappings.Count > properties.Count)
//{
// m_compilerOutputBuilder.AddError(
// m_compilerNotificationMessageBuilder.TooFewTableTypeInterfaceMappingItems(m_fullName, contract.InterfaceName, properties.Count, fieldMappings.Count));
//}
var unexpectedColumnMappingNames = fieldMappings.Where(m => !(this.m_ixColumnNames.Contains(m.DataFieldName)));
var mapping = new Mapping<DataColumnInfo, CompilerInputContractProperty>(
dataRowContractMapping
.Mapping
.ToDictionary(m => m.DataFieldName, m => m.ContractPropertyName, StringComparer.Ordinal));
var pairs = mapping.Map(this.m_columnInfos, properties);
foreach (var pair in pairs)
{
this.m_interfaceMappings.Add(
new CompilerOutputInterfacePropertyMapping
{
InterfaceName = dataRowContractMapping.InterfaceName,
ColumnName = pair.Source.ColumnName,
PropertyName = pair.Target.PropertyName,
PropertyType = pair.Target.PropertyType
});
}
}