protected override void Configure() { //// To GiftModel Mapper.CreateMap<string, GiftModel>() .ConvertUsing(i => { var giftData = i.Split(':'); var giftModel = new GiftModel(); giftModel.Name = giftData[0]; giftModel.Description = giftData[1]; return giftModel; }); Mapper.CreateMap<string, IEnumerable<GiftModel>>() .ConvertUsing(i => { var giftSourceList = i.Split(';'); return Mapper.Map<List<GiftModel>>(giftSourceList); }); }
public void 當執行轉換字串為GiftModel() { this.gift = Mapper.Map<GiftModel>(this.giftString); }