How to handle null IEnumerable (Misconfiguration) #552
Replies: 1 comment
-
Hey, thanks for using Mapperly. Do you have nullable reference types enabled? I think you can resolve this issue by annotating your properties like so: public class Person
{
public int SSN { get; set; }
public string Name { get; set; }
public IEnumerable<Person?>? Children { get; set; }
public Person? Father { get; set; }
public Person? Mother { get; set; }
public Person? FavoritePerson { get; set; }
} I wouldn't recommend this but adding |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!! thanks for taking the time to check this out.
This is my mapper:
And this is the test that is not passing because a null IEnumerable (the children list):
The workaround I can think of is performing some checking and cleaning using this https://mapperly.riok.app/docs/configuration/before-after-map. Is there a way to handle this without adding any Before / after map code?
I have already tried using Mapper attributes (those you see in the mapper class code).
Thanks again
Beta Was this translation helpful? Give feedback.
All reactions