I am following "step-by-step devolopment" documentation. "Should_Create_Person_With_Valid_Arguments" test is giving an error. Can you please guide me how i need to correct this issue?
Result Message: Missing type map configuration or unsupported mapping.
Mapping types: CreatePersonInput -> Person OY.EvdenIs.People.Dto.CreatePerson.Input -> OY.EvdenIs.People.Person
Note: I have created Person table with "Guid" type ID instead of "long" by using code: public class Person: FullAuditedEntity<Guid>
Do i need to make any change to the given code while defining CreatePerson DTO? public class CreatePersonInput
I have tryed "public class CreatePersonInput: FullAuditedEntity<Guid>" but itt didnt work.
5 Answer(s)
-
0
Hi,
Did you add AutoMap attriute to your Dto ?
-
0
Yes. As it is written in the document.
[AutoMapTo(typeof(Person))] public class CreatePersonInput { [Required] [MaxLength(Person.MaxNameLength)] public string Name { get; set; }
[Required] [MaxLength(Person.MaxSurnameLength)] public string Surname { get; set; } [EmailAddress] [MaxLength(Person.MaxEmailAddressLength)] public string EmailAddress { get; set; }
}
Can you please send a sample code for "CREATING A NEW PERSON" , if we should define PbPersons tabke with FullAuditedEntity<Guid> ?
-
0
Hi,
Can I ask, which teplate type you used for this sample ? Angular1, Angular2 ASP.NET Core or ASP.NET MVC 5.x ?
Can you please send a sample code for "CREATING A NEW PERSON" , if we should define PbPersons tabke with FullAuditedEntity<Guid> ?
It should be similar to one with long or int. Do you have a specific error ?
Thanks.
-
0
My template is:
Angular2 + ASP.NET Core
System is giving error in line: var person = input.MapTo<Person>();
public async Task CreatePerson(CreatePersonInput input) { var person = input.MapTo<Person>(); await _personRepository.InsertAsync(person); }
INPUT PARAMETERS:
{ "input": { "name": " zxcxc", "surname": "zxczxc", "emailAddress": "[email protected]", "isDeleted": false, "deleterUserId": null, "deletionTime": null, "lastModificationTime": null, "lastModifierUserId": null, "creationTime": "2017-03-27T09:00:11.899872+04:00", "creatorUserId": null, "id": "00000000-0000-0000-0000-000000000000" } }
ERROR LOG:
AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.
CreatePersonInput -> Person OY.EvdenIs.People.Dto.CreatePerson.Input -> OY.EvdenIs.People.Person
-
0
Hi,
Can you send your project to <a href="mailto:[email protected]">[email protected]</a> ? I have tried with Guid and it worked for me, I can check and fix your project because using the entity with guid does not require any extra effort.
Thanks.