AbpHelper.CLI icon indicating copy to clipboard operation
AbpHelper.CLI copied to clipboard

AggregateRoot with nested Entity

Open Climax85 opened this issue 3 years ago • 3 comments

For example, there is a Blog AggregateRoot with a list property of Posts:

public class Blog : AggregateRoot<Guid>
{
    public virtual string Title { get; protected set; }

    public virtual List<Post> Posts { get; protected set; }
}

public class Post : Entity<Guid>
{
    public virtual string Title { get; protected set; }

    public virtual string Content { get; protected set; }
}

When I generate the code for Blog, I would expect that a BlogDto and a PostDto would be generated. Where the BlogDto contains a List of PostDto.

But what I get is just a BlogDto with a property of type List<Post> instead of List<PostDto>.

Would it be possible to support nested entities?

Climax85 avatar May 24 '21 12:05 Climax85

Unfortunately, that's not supported yet.

wakuflair avatar May 25 '21 05:05 wakuflair

Thank you for the fast reply. Is this task in your roadmap? Could you give advise where and how to implement that on my own? Should be some recursive function. But I'm not familiar with elsa workflow yet. So I'm not sure where to implement that. There should probably be a list of EntityInfo?!

Climax85 avatar May 26 '21 04:05 Climax85

Hi @Climax85

Is this task in your roadmap

Not for recent plan.

Could you give advise where and how to implement that on my own?

I think it's possible to implement this through Roslyn service, which is already used to parse entity classes. It's not very related with elsa, although everything in ABPHelper is implemented as an elsa workflow. For now entity properties are parsed as strings, for your feature, they should be parsed with more info rather than a simple string.

You might need a pre scan of all entity types.

A little bit trivial, but possible.

wakuflair avatar May 26 '21 04:05 wakuflair