You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would want to map a class structure for logs. The main class is a generic class Audit<T> where T is class LogData or a subclass it.
DTO would have a simple structure with AuditDTO and property of type LogDataDTO, that object has all the possible subclass properties united in it.
My initial issues occurred at compile time as CompileException .
If my configuration has config.NewConfig<LogData, LogDataDTO>() <-- with all base class properties mapped plus .IgnoreNonMapped(true) .Include<LogDataSubclass, LogDataDTO>() <-- for all subclass of LogData
and config.NewConfig<LogDataSubclass, LogDataDTO>() <-- with all the specific subclass properties mapped plus .IgnoreNonMapped(true)
then it would complain about LogDataDTO not having a corresponding source member mapped or ignored: SOME properties of LogDataSubclasses' - but weird enough not all of them. If I added to the LogData baseclass config explicitly the .Ignore(dest => dest.ProblematicSubclassProp) then that would solve the issue.
Second issue occurred afterward at runtime. The AuditDTO had the same exception that its properties, other than the LogData, are not mapped or ignored. Adding an explicit config for mapping seems trickier as it does not seem to work with invariance:
if there's config.NewConfig<Audit<LogData>(), AuditDTO>(), or any other type of <Audit<LogDataSubclass>, AuditDTO> then the source type causing the error is referred to as <IAudit<ILogData>>. (Conventional interfaces)
I have the impression that i heavily overcomplicate the config and not using (misusing) some methods here... IgnoreNonMapped is definetely not working as expected and makes this whole declarartion redundant.
The text was updated successfully, but these errors were encountered:
I would want to map a class structure for logs. The main class is a generic class
Audit<T>
whereT
is classLogData
or a subclass it.DTO would have a simple structure with
AuditDTO
and property of typeLogDataDTO
, that object has all the possible subclass properties united in it.CompileException
.If my configuration has
config.NewConfig<LogData, LogDataDTO>()
<-- with all base class properties mapped plus.IgnoreNonMapped(true)
.Include<LogDataSubclass, LogDataDTO>()
<-- for all subclass of LogDataand
config.NewConfig<LogDataSubclass, LogDataDTO>()
<-- with all the specific subclass properties mapped plus.IgnoreNonMapped(true)
then it would complain about LogDataDTO not having a corresponding source member mapped or ignored: SOME properties of LogDataSubclasses' - but weird enough not all of them. If I added to the LogData baseclass config explicitly the
.Ignore(dest => dest.ProblematicSubclassProp)
then that would solve the issue.AuditDTO
had the same exception that its properties, other than the LogData, are not mapped or ignored. Adding an explicit config for mapping seems trickier as it does not seem to work with invariance:if there's
config.NewConfig<Audit<LogData>(), AuditDTO>()
, or any other type of<Audit<LogDataSubclass>, AuditDTO>
then the source type causing the error is referred to as<IAudit<ILogData>>
. (Conventional interfaces)I have the impression that i heavily overcomplicate the config and not using (misusing) some methods here... IgnoreNonMapped is definetely not working as expected and makes this whole declarartion redundant.
The text was updated successfully, but these errors were encountered: