Automapper

private void MostrarListado() { dbMemorialPracticaEntities db = new dbMemorialPracticaEntities(); //AutoMapper initialize var config = new MapperConfiguration(cfg => { cfg.CreateMap<Mausoleos, EMausoleos>(); cfg.CreateMap<Clientes, EClientes>(); //....puede ir todas las mapeos que se nesesite }); IMapper iMapper = config.CreateMapper(); var List = new List<Mausoleos>(); List = db.Mausoleos.ToList(); var destination = iMapper.Map<List<Mausoleos>,List<EMausoleos>>(List); dgv.DataSource = destination; }
Este codigo es para mapear un objeto a otro objeto de uno a muchos 1..*

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.