Lamp
Shadow Prop Error with IdentityDbContext
This is my IdentityDbContext:
public class ApplicationUser : IdentityUser
{
[Required(ErrorMessage = "First name is required")]
[Display(Name = "First Name")]
[MaxLength(50)]
public string FirstName { get; set; }
[Required(ErrorMessage = "Last name is required")]
[Display(Name = "Last Name")]
[MaxLength(50)]
public string LastName { get; set; }
public virtual ICollection<ApplicationUserClaim> Claims { get; set; }
public virtual ICollection<IdentityUserLogin<string>> Logins { get; set; }
public virtual ICollection<IdentityUserToken<string>> Tokens { get; set; }
}
public class ApplicationRole : IdentityRole
{
}
public class ApplicationUserRole : IdentityUserRole<string>
{
public bool IsReadOnly { get; set; }
public string ProgramId { get; set; }
public bool IsDefault { get; set; }
public virtual TestProgram Program { get; set; }
}
public class ApplicationRoleClaim : IdentityRoleClaim<string>
{
public virtual ApplicationRole Role { get; set; }
}
public class ApplicationUserClaim : IdentityUserClaim<string>
{
public virtual ApplicationUser User { get; set; }
}
I keep getting weird errors, especially when using the Login page, where it includes extra userid columns in the query, e.g. "UserId1". Any idea how to fix? I've been researching for quite a while and would love a hint in the right direction. Please let me know any additional information that would be needed. Also, I do have "base.OnModelCreating(modelBuilder);" in my dbcontext OnModelCreating method.
1 replies
MudBlazor darkmode toggle not working
I just want to check system preferences on load for the theme, but also allow the user to change from dark to light mode whenever they want. The toggle just doesn't work. I click on it and nothing happens.
@inherits LayoutComponentBase
<MudThemeProvider @ref="@provider" @bind-IsDarkMode="@useDarkMode" />
<MudDialogProvider />
<MudSnackbarProvider />
<MudLayout>
<MudAppBar Elevation="1">
<MudText Typo="Typo.h5" Class="ml-3">[Text Here]</MudText> <MudSpacer/> <MudSwitch @bind-Value="useDarkMode" Color="Color.Primary" Class="ma-4" T="bool" Label="Toggle Light/Dark Mode" /> <MudIconButton Icon="@Icons.Material.Filled.MoreVert" Color="Color.Inherit" Edge="Edge.End"/> </MudAppBar> <MudMainContent> @Body </MudMainContent> </MudLayout> @code { private bool useDarkMode; private MudThemeProvider provider; protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { useDarkMode = await provider.GetSystemPreference(); await provider.WatchSystemPreference(OnSystemPreferenceChanged); StateHasChanged(); } } private async Task OnSystemPreferenceChanged(bool newValue) { useDarkMode = newValue; StateHasChanged(); } }
<MudText Typo="Typo.h5" Class="ml-3">[Text Here]</MudText> <MudSpacer/> <MudSwitch @bind-Value="useDarkMode" Color="Color.Primary" Class="ma-4" T="bool" Label="Toggle Light/Dark Mode" /> <MudIconButton Icon="@Icons.Material.Filled.MoreVert" Color="Color.Inherit" Edge="Edge.End"/> </MudAppBar> <MudMainContent> @Body </MudMainContent> </MudLayout> @code { private bool useDarkMode; private MudThemeProvider provider; protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { useDarkMode = await provider.GetSystemPreference(); await provider.WatchSystemPreference(OnSystemPreferenceChanged); StateHasChanged(); } } private async Task OnSystemPreferenceChanged(bool newValue) { useDarkMode = newValue; StateHasChanged(); } }
18 replies