Servant-Software-LLC / FileBased.DataProviders

ADO.NET & EF Core Data Providers for common serializable formats (JSON, XML, and CSV) stored to disk.
2 stars 1 forks source link

INSERTs to fill in identity values #31

Closed DaveRMaltby closed 1 year ago

DaveRMaltby commented 1 year ago

EF Core uses a series of conventions to determine the default identity columns:

  1. Property named Id: If a class has a property named Id, by convention EF Core treats this as the primary key.
  2. Id: EF Core will also look for a property named Id as the primary key if no property named Id is found.

If the property type is numeric or Guid, EF Core will further infer that it should be a generated (identity) column.

In our providers, we should also follow this logic. Even though we may not have a datatype (like in the case CSV), we can check the last row of the table to see if the value 'looks' like a number or Guid.

DaveRMaltby commented 1 year ago

Hopefully good enough for now.