Skip to content

Consider adding support for referencing non-primary key columns to foreign keys in Dapper.SimpleSave #2

@bartread

Description

@bartread

Something to consider...

Currently for Dapper.SimpleSave's foreign key support to work, it assumes that you're always referencing the PK value of the target table. This might not necessarily be so.

We should consider whether or not this is a problem and whether we need to add support for FKs referencing other non-PK columns (they'd still have to be ints or GUIDs, because these are the only key types we support).

I'd broadly disfavour implementing this for a couple of reasons:

(1) Why have an FK column that doesn't reference a PK column? What would be the purpose? It sounds needlessly complex.

(2) Dapper.SimpleSave is supposed to help with the main and the plain, not every possible edge/corner case, and this definitely feels like one of the latter.

It certainly could be done, but it feels like it would be encouraging perhaps a lack of discipline in the way we use foreign keys in the database.

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