Entities
Entity definitions need to follow certain rules in order to work with Xams.
Entity Rules
- Entities must have a string Name field or a string field with the attribute
UIName
for lookup fields. - Composite Primary Keys are not supported.
- Self-referencing entities must NOT include navigation properties to themselves.
- System entities use base table names:
User
,Team
,Role
,Setting
are always the table names—even when extended (e.g.,public class AppUser : User
→ table name is"User"
for queries and permissions).
Self-Referencing Entities
For entities that reference themselves (like nested comments), use only the ID field - do not include the navigation property.
Project / Entities / Comment.cs
Navigation properties on self-referencing entities cause nullable reference errors during queries. Use only the ID field and query parent/child records separately if needed.
Cascade Delete
Configure cascade delete using the nullable operator ?
and the CascadeDelete
attribute.
Project / Entities / Widget.cs
When a user deletes a record, delete permissions are checked only on the record being deleted—not on any dependent records removed through cascading. This behavior is consistent with how enterprise CRM systems operate.