-
Notifications
You must be signed in to change notification settings - Fork 347
Open
Description
For those like me that went the MSSQL route on the CommandsService Project instead of keeping it in memory, you will most likely run into an issue with inserting a platform in the EventProcessor that does not happen when using in memory.
The mapping used for PlatformPublishedDto
CreateMap<PlatformPublishedDto, Platform>()
.ForMember(dest => dest.ExternalId, opt => opt.MapFrom(src => src.Id));
while mapping the PlatformService's PlatformPublishedDto.Id to a CommandsService's PlatformPublishedDto.ExternalId , it will leave the same PlatformService's PlatformPublishedDto.Id also mapped to the CommandsService's PlatformPublishedDto.Id
That will cause MSSQL to complain about inserting with an explicit IDENTITY.
To fix this, you have to tell AutoMapper to ignore Id on the destination like below:
CreateMap<PlatformPublishedDto, Platform>()
.ForMember(dest => dest.ExternalId, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Id, opt => opt.Ignore());
lilpaf
Metadata
Metadata
Assignees
Labels
No labels