Skip to content

Commit

Permalink
adding a readme for blazor identity for scenario specific information. (
Browse files Browse the repository at this point in the history
#2999)

* adding a readme for blazor identity for scenario specific information.

* PR suggestions added.

* updated to fwlink
  • Loading branch information
deepchoudhery authored Oct 8, 2024
1 parent 0eeba65 commit fc75fae
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,18 @@ public async Task GenerateCode(BlazorIdentityCommandLineModel model)

var blazorTemplateModel = await ValidateAndBuild(model);
ExecuteTemplates(blazorTemplateModel);
AddReadmeFile(blazorTemplateModel.BaseOutputPath);
await ModifyFilesAsync(blazorTemplateModel);
}

internal void AddReadmeFile(string outputPath)
{
string fileName = BlazorIdentityHelper.BlazorIdentityReadmeFileName;
string readmeFilePath = Path.Combine(outputPath, fileName);
FileSystem.WriteAllText(readmeFilePath, BlazorIdentityHelper.BlazorIdentityReadmeString);
Logger.LogMessage($"Added Blazor identity file : {fileName}");
}

internal async Task<BlazorIdentityModel> ValidateAndBuild(BlazorIdentityCommandLineModel commandlineModel)
{
commandlineModel.DatabaseProvider = ModelMetadataUtilities.ValidateDatabaseProvider(commandlineModel.DatabaseProviderString, Logger, isIdentity: true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,23 @@ internal static CodeSnippet[] ApplyIdentityChanges(CodeSnippet[] filteredChanges

return filteredChanges;
}

internal static string BlazorIdentityReadmeFileName = "Scaffolding-README.md";
internal static string BlazorIdentityReadmeString =
@"Blazor Identity scaffolding has completed successfully.
For setup and configuration information, see https://go.microsoft.com/fwlink/?linkid=2290075.
If the project had identity support prior to scaffolding, ensure that the following changes are present in Program.cs:
1. Correct DbContextClass is used in the following statements :
- var connectionString = builder.Configuration.GetConnectionString(DBCONTEXT_CONNECTIONSTRING) ...
- builder.Services.AddDbContext<DBCONTEXT>(options => ...
- builder.Services.AddIdentityCore<IDENTITY_USER_CLASS>...
.AddEntityFrameworkStores<DBCONTEXT>() ...
2. Correct Identity User class is being used, (if using the default 'IdentityUser' or a custom IdentityUser class).
- builder.Services.AddIdentityCore<IDENTITY_USER_CLASS>...
- builder.Services.AddSingleton<IEmailSender<IDENTITY_USER_CLASS>...
";

}
}

0 comments on commit fc75fae

Please sign in to comment.