Closed vflame closed 1 year ago
Can you clarify or share an example as this should be working. There is a unit test specifically for nested members here:
Sure, please see below.
The following:
public class UserDto
{
public int Id { get; set; }
public OrderDto Order { get; set; }
public class OrderDto
{
public int OrderId { get; set; }
}
}
public static class Extensions
{
[Projectable]
public static UserDto ToDto(this User user) => new UserDto() {
Id = user.Id,
Order = new UserDto.OrderDto() {
OrderId = user.Orders.First().OrderId,
}
};
}
Generates:
// <auto-generated/>
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class BasicSample_Extensions_ToDto
{
static global::System.Linq.Expressions.Expression<global::System.Func<global::BasicSample.User, global::BasicSample.UserDto>> Expression()
{
return (global::BasicSample.User user) => new global::BasicSample.UserDto()
{
Id = user.Id,
Order = new UserDto.OrderDto()
{
OrderId = global::System.Linq.Enumerable.First(user.Orders).OrderId,
}
};
}
}
}
Should be fixed of #68
Thanks for reporting this!
When classes are nested inside another class, the full namespace + outer type isn't generated