ND1001: NativeData entity key column must map to a public property

Summary

ND1001 warns when [NativeDataEntity(..., keyColumn)] specifies a key column that does not match any public readable property on the entity type.

Why this matters

  • NativeData mapping relies on a resolvable key member for repository operations.
  • A key-column/property mismatch causes generated mapping to fail or behave unexpectedly.
  • Catching this at analysis time prevents runtime and generation-time surprises.

Trigger example

[NativeDataEntity("Widgets", "WidgetId")]
public sealed class Widget
{
    public int Id { get; set; }
}

Use one of the following:

  • Rename/add a public property that matches the declared key column.
  • Update the keyColumn argument to match the actual key property name.
  • Use the default key column (Id) when appropriate.

Diagnostic details

  • ID: ND1001
  • Category: NativeData.Mapping
  • Default severity: Warning
  • Message: Entity '{type}' is marked with [NativeDataEntity] key column '{key}', but no matching public readable property was found

Suppression guidance

Suppress only when key mapping is intentionally handled outside standard NativeData entity conventions.