Skip to content

Feature request: also force all source properties to be in destination #551

Open
@suntereo

Description

@suntereo

Thanks for a great and useful package!

We are using RequireDestinationMemberSource and it works well:

  • RequireDestinationMemberSource:
    "Forcing all destination properties to have a corresponding source member or explicit mapping/ignore" (source)

But we also have a need to check the other direction.
Is there any plans or would it be possible to introduce a new property:

  • RequireSourceMemberDestination:
    Force all source properties to have a corresponding destination member

One scenario is where there's a one-way mapping from a stored proc DAO to DTO. A field is added to the table, picked up and added to the DAO by the EF Core PowerTools Reverse Engineering Tool, but not added to the DTO because the programmer forgot. We would love to see it throw an error here to alert us that the new property need to also be added to the DTO (destination) because it's in the source (DAO).

Another scenario is where a property is added to a request for a Save() web method. It was added to the SL but the programmer fails to add it to the DTO (and DAO). It might appear as though this new property is being saved from the front-end. But it isn't because it's just ignored. We would love to see an error thrown here to alert us that it's not being passed down.

p.s. The property names always confuse me. Wouldn't this be better:

  • EveryDestinationPropertyMustBeInSource (existing property)
  • EverySourcePropertyMustBeInDestination (new property)
    Or even:
  • RequireAllDestinationPropertiesToBeInSource (existing property)
  • RequireAllSourcePropertiesToBeInDestination (new property)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions