ND1002: NativeDataEntity literals must be non-empty
Summary
ND1002 warns when [NativeDataEntity(tableName, keyColumn)] uses an empty or whitespace literal for tableName or keyColumn.
Why this matters
- NativeData mapping relies on explicit, stable table/key names.
- Empty or whitespace literals lead to ambiguous or broken generated mapping behavior.
- Catching invalid literals early improves generator diagnostics and developer experience.
Trigger examples
[NativeDataEntity(" ", "Id")]
public sealed class Widget
{
public int Id { get; set; }
}
[NativeDataEntity("Widgets", " ")]
public sealed class Widget
{
public int Id { get; set; }
}
Recommended fixes
- Provide a non-empty, non-whitespace
tableName. - Provide a non-empty, non-whitespace
keyColumn, or omit it to use the defaultId.
Diagnostic details
- ID:
ND1002 - Category:
NativeData.Mapping - Default severity:
Warning - Message:
Entity '{type}' has invalid [NativeDataEntity] value for '{arg}'; use a non-empty, non-whitespace literal
Suppression guidance
Suppress only for exceptional cases with explicit alternate mapping behavior.