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
Is your feature request related to a problem? Please describe.
When Project disable nullable reference type,The navigation properties of IQueryable ProjectTo do not require null checks.
publicstaticpartialclassMapperConfigs{[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly","4.1.1.0")]publicstaticpartialglobal::ConsoleApp1.PostDto?ToDto(thisglobal::ConsoleApp1.Post?car){if(car==null)returndefault;vartarget=newglobal::ConsoleApp1.PostDto(car.Id,car.Title,car.Content,car.CategoryId);target.CategoryName=car.Category?.Name;if(car.Comments!=null){target.CommentsCount=car.Comments.Count;}returntarget;}[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly","4.1.1.0")]publicstaticpartialglobal::System.Linq.IQueryable<global::ConsoleApp1.PostDto?>?Project(thisglobal::System.Linq.IQueryable<global::ConsoleApp1.Post?>?q){if(q==null)returndefault;
#nullable disable
returnSystem.Linq.Queryable.Select(q,
x =>newglobal::ConsoleApp1.PostDto(x.Id,x.Title,x.Content,x.CategoryId){CategoryName=x.Category!=null&&x.Category.Name!=null?x.Category.Name:default,CommentsCount=x.Comments!=null?x.Comments.Count:default,});
#nullable enable
}}
The generated SQL:
SELECT p."Title",p."Content", p."CategoryId", p."Id", c."Id", c0."Id", c0."Content", c0."UserId", c0."PostId", (
SELECTcount(*)::intFROM"Comment"AS c1
WHERE p."Id"= c1."PostId"), CASE
WHEN c."Id"IS NOT NULLAND c."Name"IS NOT NULL THEN c."Name"
END
FROM"Post"AS p
LEFT JOIN"Category"AS c ON p."CategoryId"= c."Id"LEFT JOIN"Comment"AS c0 ON p."Id"= c0."PostId"ORDER BY p."Id", c."Id"
Expect:
publicstaticpartialclassMapperConfigs{[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly","4.1.1.0")]publicstaticpartialglobal::ConsoleApp1.PostDto?ToDto(thisglobal::ConsoleApp1.Post?car){if(car==null)returndefault;vartarget=newglobal::ConsoleApp1.PostDto(car.Id,car.Title,car.Content,car.CategoryId);target.CategoryName=car.Category?.Name;if(car.Comments!=null){target.CommentsCount=car.Comments.Count;}returntarget;}[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly","4.1.1.0")]publicstaticpartialglobal::System.Linq.IQueryable<global::ConsoleApp1.PostDto?>?Project(thisglobal::System.Linq.IQueryable<global::ConsoleApp1.Post?>?q){if(q==null)returndefault;returnSystem.Linq.Queryable.Select(q,
x =>newglobal::ConsoleApp1.PostDto(x.Id,x.Title,x.Content,x.CategoryId){CategoryName=x.Category.Name,CommentsCount=x.Comments.Count,});}}
Expect generated SQL:
SELECT p."Title", p."Content", p."CategoryId", (
SELECTcount(*)::intFROM"Comment"AS c0
WHERE p."Id"= c0."PostId") AS"CommentCount", c."Name"AS"CategoryName",
FROM"Post"AS p
LEFT JOIN"Category"AS c ON p."CategoryId"= c."Id"
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When Project disable nullable reference type,The navigation properties of IQueryable ProjectTo do not require null checks.
Describe the solution you'd like
Source:
Actual:
The generated SQL:
Expect:
Expect generated SQL:
The text was updated successfully, but these errors were encountered: