Closed buraktamturk closed 1 year ago
The build failure seems unrelated to what this library is doing. (Also note that the code sample is broken).
This works for me:
public class VFileDTO
{
public int id { get; set; }
}
public class VFile
{
public int id { get; set; }
}
public class ContentDTO
{
public VFileDTO? featured_image { get; set; }
}
public class Content
{
public VFile? featured_image { get; set; }
}
public static class ContentExtensions
{
[Projectable]
public static VFile ToVFile(this VFileDTO a) => new VFile {
id = a.id
// ...
};
[Projectable(NullConditionalRewriteSupport = NullConditionalRewriteSupport.Ignore)] // fails with the above error when ? is used
public static Content ToContent(this ContentDTO ms) => new Content {
featured_image = ms.featured_image?.ToVFile()
};
}
Oh, perhaps the problem occurs when the models are in different projects. Like this:
Commenting the other code fixes the build issue:
Sample project: Archive.zip
Good catch, this got introduced with the release of V3, in particular by this PR: https://github.com/koenbeuk/EntityFrameworkCore.Projectables/pull/49
ExtensionMethods are not getting fully qualified if any of the parents within the hierarchy are of ConditionalAccessExpressions.
I'll work on a fix in the coming days.
Hello, thanks for such an amazing library again.
The build fails with
when using null propagation. Example code:
My guess is that the source generator does not qualify the assembly and the class correctly when handling null conditions.
Thanks a lot!