© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
9 replies
rokibox

✅ Best practice with EF Core "constants"?

How to work with user groups correctly: I have a User relation that contains the id of the group in which it is located. By default, there are two user roles: User with id 1 and Admin with id 2. There are services that need to know which group a user of these two is in. How to properly organize it? Create a constant with the id of the user role and the id of the admin role and pass it throughout the application? Or create a constant with the name of the role, and each time look for the ID of this role by name? Or are there better ways to deal with this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

EF Core
C#CC# / help
2y ago
✅ EF Core migrations with Docker
C#CC# / help
11mo ago
Calculated Properties with EF Core
C#CC# / help
2y ago
✅ System.NotSupportedException with EF Core
C#CC# / help
3y ago