Hi,
I am using LLBLGen 5.4 and LLBLGen Runtime Pro Framework in a .NET Standard 2.0 Class Library.
I am transferring data to ElasticSearch and I need to know, what the object type originally was before it was projected to a Dto, so I can store the object type in ElasticSearch and also return the object type along with the other properties through my WebApi.
For example I have an Entity called CarEntity and a Dto called CarDto. I would like the CarDto to have a property called ObjectType which should contain the value "CarEntity". This property should be Model Only.
I have creating a partial class for the CarDto that contains an ObjectType Property and added the following code to the CreateProjectionFunc method in CarDtoPersistence class:
// __LLBLGENPRO_USER_CODE_REGION_START ProjectionRegion_CarDto
ObjectType = p__0.GetType().Name,
// __LLBLGENPRO_USER_CODE_REGION_END
However there are two problems with this approach:
1: The CarDto does have the correct ObjectType property when I look at the Object in Visual Studio, however it does not get returned in a WebAPI call. It looks like the property gets lost when you serialize the Dto. Is there any way to force this property to be serialized as well?
2: I need to create a partial class for each Dto I want to add this property to. Is there an Dto equivalent of CommonEntityBase that I can extend instead?
Or am I going about this the completely wrong way?
Best regards,
Andreas