AutoMapper简明教程(学习笔记)

].FirstName + nameDto12[].LastName);
Console.WriteLine();
//Console.ReadKey();
//emitMapper error
//List<NameDto>
nameDto20 =
EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<IDataReader,
List<NameDto>>().Map(dt.CreateDataReader());

");
Console.WriteLine(name15.FirstName);
Console.WriteLine();
Console.ReadKey();
}
}

public class Store
{
public Name Name { get; set; }
public int Age { get; set; }
}

public class Name
{
public string FirstName { get; set; }
public string LastName { get; set; }
}

public class StoreDto
{
public NameDto Name { get; set; }
public int Age { get; set; }
}

public class NameDto
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string AllName { get; set; }
}

public class FlattenName
{
public string NameFirstname { get; set; }
public string NameLastName { get; set; }
}

public class NameConverter : TypeConverter<Name, NameDto>
{
protected override NameDto ConvertCore(Name source)
{
return new NameDto() { AllName = source.FirstName + source.LastName };
}
}

public class NameResolver : ValueResolver<Name, NameDto>
{
protected override NameDto ResolveCore(Name source)
{
return new NameDto() { FirstName = source.FirstName, LastName = source.LastName };
}
}

public class NameFormatter : ValueFormatter<NameDto>
{
protected override string FormatValueCore(NameDto name)
{
return name.FirstName + name.LastName;
}
}

public class StringFormatter : ValueFormatter<string>
{
protected override string FormatValueCore(string name)
{
return name + "-";
}
}
}

上一篇:在Visual Studio 2012 Blue theme下使用Dark theme的文本编辑器颜色设置


下一篇:使用抓包工具SpyNet对你的网络进行监控