C
C#15mo ago
schwartzmj

✅ Question on Claims vs Relations

Say I have User, Organization, and ExampleModel models. I may want to list all users in an organization somewhere. I also only want to show ExampleModels that belong to the User's Organization on some Index page. Before learning about Claims, I'd just set an OrganizationId on both the User and ExampleModel and filter based on that. What's the purpose of Claims here if any? Thank you!
3 Replies
schwartzmj
schwartzmj15mo ago
For example I could give a User a claim to an Organization signifying that they belong to it, but why wouldn't I just make that a relation?
Angius
Angius15mo ago
Claims are not there to establish relationships Claims are there to store data about the user in the session/JWT/whatever So the name, email, avatar URL, stuff like that Relations are there to properly set the database up. So that joins, selects, everything like that can work properly and perform well
schwartzmj
schwartzmj15mo ago
Thank you!