Entlib DAAB映射枚举类型

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();

 

posted @ 2015-01-06 10:39  tyb1222  阅读(236)  评论(0编辑  收藏  举报