C
C#2w ago
witeks44

Default data in Configuration Table for User created using Identity

Hello, I'm a total newbie in the backend/database field. I'm trying to implement a simple application with authentication using Identity. Let's say I have a Configuration table in a one-to-one relationship with the User table. I'd like to create an entry with default values when a user is registered. How should I approach this? 1. Can I use the endpoints generated by Identity? Can I override them so that creating a new user also creates a default entry in the Configuration table? Or should the database have a transaction defined to cascade the addition of an entry in the related table? 2. Should I create my own endpoint to register a user and handle the creation of an entry in the Configuration table? What should the approach be in this situation?
2 Replies
Angius
Angius2w ago
Alas, you can't easily override or even disable Identity endpoints For some reason they don't support scaffolding, even though Identity pages do
witeks44
witeks44OP2w ago
Hmm, so the solution would be to create the configuration table entry when there is a need for it. I could create a getConfiguration endpoint that creates a new entry if one currently does not exist. But it sounds like a bad practice...

Did you find this page helpful?