我正在尝试将数据绑定到表单,但我不断收到以下错误:
AbDesktop.FrmCreditCards.tmpData 是一个“字段”,但用作“类型”。
这是导致错误的代码,我们将不胜感激。
public partial class FrmCreditCards : Form
{
tmpCreditCardData tmpData = new tmpCreditCardData() { CreditCardName = "Reece" };
private HotelConferenceEntities db = new HotelConferenceEntities();
private tblCreditCard databaseAccessObject;
private tmpData dataTransferObject;
public void databinding()
{
// Create forward map using AutoMapper - from database to dataTransfer
AutoMapper.Mapper.CreateMap<tblCreditCard, tmpData>()
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.CreditCardName));
// Create reverse map using AutoMapper - from dataTransfer to database
AutoMapper.Mapper.CreateMap<tmpData, tblCreditCard>()
.ForMember(dest => dest.CreditCardName, opt => opt.MapFrom(src => src.Name));
}