هل يمكن للسيارات إنشاء رسم بياني كائن من كائن مسطح؟

StackOverflow https://stackoverflow.com/questions/2865472

  •  30-09-2019
  •  | 
  •  

سؤال

هل من الممكن مع Automapper تعيين كائن مسطح إلى الرسم البياني الكائن المعقد؟

 Mapper.CreateMap<PersonDto,Person>()

خريطة persondto.birthCertificatefathername to person.birthCertificate.Fathername

هل كانت مفيدة؟

المحلول

لا ، لا يمكن ، فهي تفعل ذلك في الاتجاه الآخر

Person.BirthCertificate.FatherName to  PersonDto.BirthCertificateFatherName

تحديث: القيمة تستطيع فعلها:

//unflattening
person.InjectFrom<UnflatLoopValueInjection>(personDto);

//flatenning
personDto.InjectFrom<FlatLoopValueInjection>(person);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top