Skip to content

Rewrite extension methods #5

Description

@kemsky

Custom extension methods break EF translation, but we can rewrite them.

public static readonly Projection<DepartmentEntity, DepartmentDto> DepartmentDtoProjection = new (
    x => new DepartmentDto
    {
        Name = x.Name,
        Status = x.Status.ToDtoStatus()
    }
);
public static StatusDto ToDtoStatus(this Status status)
{
    return StatusDtoProjection.Project(status);
}

Can be translated to:

public static readonly Projection<DepartmentEntity, DepartmentDto> DepartmentDtoProjection = new (
    x => new DepartmentDto
    {
        Name = x.Name,
        Status = StatusDtoProjection.Project(x.Status)
    }
);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions