Skip to content

Generate IEnumerable<long> for navigation properties instead of full objects #130

@RohitM-IN

Description

@RohitM-IN

Hi,

I noticed in PR #47 (saw this late: #12) that you’re adding support for including navigation properties in generated DTOs.

I have a use case where instead of including the full navigation objects, I’d like to include only their IDs in the generated DTOs.

For example, given a model like this:

public class Category
{
    public int Id { get; set; }
    public string Name { get; set; } = null!;
    public virtual ICollection<Product> Products { get; set; } = new List<Product>();
}

I’d like the generated CreateDto / UpdateDto to look like:

public record CategoryCreateDto
{
    public string Name { get; init; } = null!;
    public IEnumerable<long> ProductIds { get; init; } = new();
}

Is there a way to configure Facet so that navigation collections are represented as lists of IDs in the generated DTOs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions