Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ internal async Task<BlazorIdentityModel> ValidateAndBuild(BlazorIdentityCommandL
}

var rootIdentityNamespace = $"{commandlineModel.RootNamespace}.Components.Account";
var layoutNamespace = $"{commandlineModel.RootNamespace}.Components.Layout.MainLayout";
// For WASM/Auto Global Blazor projects, MainLayout lives in the client project (e.g. BlazorApp1.Client).
// For Blazor Server projects, it lives directly under Components/Layout/ in the server project.
var mainLayoutInServerProject = Path.Combine(AppInfo.ApplicationBasePath, "Components", "Layout", "MainLayout.razor");
var layoutNamespace = FileSystem.FileExists(mainLayoutInServerProject)
? $"{commandlineModel.RootNamespace}.Components.Layout.MainLayout"
: $"{commandlineModel.RootNamespace}.Client.Layout.MainLayout";
var defaultDbContextNamespace = $"{commandlineModel.RootNamespace}.Data";
var defaultUserNamespace = $"{commandlineModel.RootNamespace}.Data";
var blazorIdentityModel = new BlazorIdentityModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,16 @@ public override async Task<bool> ExecuteAsync(ScaffolderContext context, Cancell
if (!string.IsNullOrEmpty(projectName))
{
identityNamespace = settings.BlazorScenario ? $"{projectName}.Components.Account" : $"{projectName}.Areas.Identity";
identityLayoutNamespace = settings.BlazorScenario ? $"{projectName}.Components.Layout.MainLayout" : string.Empty;
if (settings.BlazorScenario)
{
// For WASM/Auto Global Blazor projects, MainLayout lives in the client project (e.g. BlazorApp1.Client).
// For Blazor Server projects, it lives directly under Components/Layout/ in the server project.
var mainLayoutInServerProject = Path.Combine(projectDirectory, "Components", "Layout", "MainLayout.razor");
identityLayoutNamespace = _fileSystem.FileExists(mainLayoutInServerProject)
? $"{projectName}.Components.Layout.MainLayout"
: $"{projectName}.Client.Layout.MainLayout";
}

userClassNamespace = $"{projectName}.Data";
}

Expand Down