AbpHelper.CLI
AbpHelper.CLI copied to clipboard
AggregateRoot with nested Entity
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?
Unfortunately, that's not supported yet.
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?!
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.