Closed mrdnote closed 3 years ago
Hi,
I think generating fields for empty types don't add any particular value because you can easily achieve that by copy&paste of type content definition. More interesting would be the option of adding missing fields even if the target already has some (removing differences between types). However, this won't work if target type is not defined in the source code. I will mark this issue as an enhancement but I can't promise when this will be implemented.
I don't think copy&paste works very well on generated EF entities like this:
/// <summary>
/// Id of the game
/// </summary>
public virtual int Id
{
get;
set;
}
/// <summary>
/// Title of the game
/// </summary>
public virtual string Title
{
get;
set;
}
/// <summary>
/// Start date/time of the game
/// </summary>
public virtual global::System.Nullable<System.DateTime> StartDate
{
get;
set;
}
And for generated SQL-2-Linq it's even worse...
Thanks for bringing this example.
@mrdnote Maybe in the meantime you will be interested with my another project that seems to solve the problem of synchronizing members between different types. Everything described in my blogpost https://cezarypiatek.github.io/post/csharp-twin-types/#the-solution-extending-c-rules-with-custom-analyzer
I decided that this case if out of the scoped of MappingGenerator project. I think you can resolved it by using MappingGenerator + aftermentioned TwinType attribute
Hi, thanks for this wonderful time-saving tool. It's my new favorite VS extension!
Another boring coding job I find myself repeatidly doing is writing out DTO classes which many time have the same members as the entity or model class were filling it from.
Wouldn't it be great if MappingGenerator would generate members, in case the target class is empty?
For example:
In this case ListGameDto would be an emtpy class and MappingGenerator would create the Id, Title etc. members.