首页 > 代码库 > Entlib DAAP映射枚举类型

Entlib DAAP映射枚举类型

1、

IRowMapper<UserDto> addressMapper = MapBuilder<UserDto>.MapAllProperties() .Map(p => p.Gender) .WithFunc(rec => rec.IsDBNull(rec.GetOrdinal("gender"))? Gender.Female: Gender.Male).Build();

 

或者:

IRowMapper<UserDto> addressMapper = MapBuilder<UserDto>                .MapAllProperties()                 .Map(p => p.Gender)                 .WithFunc(rec => (Gender)Enum.ToObject(typeof(Gender), rec.GetOrdinal("gender"))) .Build();

 

Entlib DAAP映射枚举类型