@@ -471,6 +471,93 @@ public class Todo
471471}
472472```
473473
474+ ### Modifying ApplicationUser
475+
476+ In many cases the AI Models will want to generate a ` User ` class for their AI models. But as Blazor Apps
477+ are already configured to use an ApplicationUser Identity Auth User class, the C# code generation only generates
478+ the User class in a comment so you can merge it with your existing ` User ` class, e.g:
479+
480+ ``` csharp
481+ /* merge with User DTO
482+ /// <summary>
483+ /// Interface defining the structure for a JobApplication.
484+ /// Represents a user's application to a specific job.
485+ /// </summary>
486+ public class User
487+ {
488+ [AutoIncrement]
489+ public int Id { get; set; }
490+ public string FirstName { get; set; }
491+ public string LastName { get; set; }
492+ public string Email { get; set; }
493+ /// <summary>
494+ /// Optional URL to the user's resume
495+ /// </summary>
496+ public string? ResumeUrl { get; set; }
497+ }
498+ */
499+ ```
500+
501+ If you wish to add additional properties, you'll first need to add it your ` ApplicationUser ` class, e.g:
502+
503+ ``` csharp
504+ public class ApplicationUser : IdentityUser
505+ {
506+ public string ? FirstName { get ; set ; }
507+ public string ? LastName { get ; set ; }
508+ public string ? DisplayName { get ; set ; }
509+ public string ? ProfileUrl { get ; set ; }
510+ /// <summary >
511+ /// Optional URL to the user's resume
512+ /// </summary >
513+ public string ? ResumeUrl { get ; set ; }
514+ }
515+ ```
516+
517+ You'll then need to regenerate the EF Migration to update the ` AspNetUsers ` table with the new columns by
518+ running the ` init-ef ` npm script:
519+
520+ ::: sh
521+ npm run init-ef
522+ :::
523+
524+ Which will delete the existing Migrations and create a new Migration to update the Identity Auth tables:
525+
526+ ``` json
527+ {
528+ "scripts" : {
529+ "init-ef" : " node -e 'fs.readdirSync(`Migrations`).filter(x => !x.startsWith(`Migration`)).forEach(x => fs.rmSync(`Migrations/${x}`))' && dotnet ef migrations add CreateIdentitySchema" ,
530+ }
531+ }
532+ ```
533+
534+ You can then delete your Primary Database (e.g. App_Data/app.db) and re-run the ` migrate ` npm script to recreate it:
535+
536+ ::: sh
537+ npm run migrate
538+ :::
539+
540+ If you want the additional property to be included in API Responses you'll also need to add it to your ` User ` DTO, e.g:
541+
542+ ``` csharp
543+ /// <summary >
544+ /// Public User DTO
545+ /// </summary >
546+ [Alias (" AspNetUsers" )]
547+ public class User
548+ {
549+ public string Id { get ; set ; }
550+ public string UserName { get ; set ; }
551+ public string ? FirstName { get ; set ; }
552+ public string ? LastName { get ; set ; }
553+ public string ? DisplayName { get ; set ; }
554+ public string ? ProfileUrl { get ; set ; }
555+ public string ? ResumeUrl { get ; set ; }
556+ }
557+ ```
558+
559+ Which OrmLite and AutoQuery will use to query Identity Auth's ` AspNetUsers ` table.
560+
474561### Custom APIs
475562
476563When you need more fine-grained control over the generated APIs, you can "takeover" the generation of
0 commit comments