❔ Services Not Working with DB Model

I have a db model
using Libraries.Shared.Models.DbModels.Authentication;
using Microsoft.AspNetCore.Identity;

namespace StoriedKingdom.Dungeon.Models.DbModels;

internal sealed class DiscordUser : AppUser<ulong>
{
internal DiscordUser(string userName, Guid auid) : base(userName, auid)
{
}
internal string Discriminator { get; set; } = string.Empty;

[ProtectedPersonalData] internal string Discord { get; set; } = string.Empty;

[ProtectedPersonalData] internal string NormalizedDiscord { get; set; } = string.Empty;

internal string? Avatar { get; set; }

internal bool? Verified { get; set; }
}
using Libraries.Shared.Models.DbModels.Authentication;
using Microsoft.AspNetCore.Identity;

namespace StoriedKingdom.Dungeon.Models.DbModels;

internal sealed class DiscordUser : AppUser<ulong>
{
internal DiscordUser(string userName, Guid auid) : base(userName, auid)
{
}
internal string Discriminator { get; set; } = string.Empty;

[ProtectedPersonalData] internal string Discord { get; set; } = string.Empty;

[ProtectedPersonalData] internal string NormalizedDiscord { get; set; } = string.Empty;

internal string? Avatar { get; set; }

internal bool? Verified { get; set; }
}
and some services that use it
addServices<TAppUser>(){
services.TryAddScoped<ISecurityStampValidator, SecurityStampValidator<TAppUser>>();

services.TryAddScoped<ITwoFactorSecurityStampValidator, TwoFactorSecurityStampValidator<TAppUser>>();
}
addServices<TAppUser>(){
services.TryAddScoped<ISecurityStampValidator, SecurityStampValidator<TAppUser>>();

services.TryAddScoped<ITwoFactorSecurityStampValidator, TwoFactorSecurityStampValidator<TAppUser>>();
}
however the service throws an error when using the model and I'm not sure why or what it means
Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.ISecurityStampValidator Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.SecurityStampValidator`1[StoriedKingdom.Dungeon.Models.DbModels.DiscordUser]'
Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.ISecurityStampValidator Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.SecurityStampValidator`1[StoriedKingdom.Dungeon.Models.DbModels.DiscordUser]'
8 Replies
JakenVeina
JakenVeina2y ago
k what's the rest of the error?
TheCultOfRa
TheCultOfRaOP2y ago
Pastebin
System.AggregateException HResult=0x80131500 Message=Some service...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
TheCultOfRa
TheCultOfRaOP2y ago
discord wouldn't let me post it so I used pastebin
JakenVeina
JakenVeina2y ago
Unable to resolve service for type 'Microsoft.AspNetCore.Identity.IPasswordHasher`1[StoriedKingdom.Dungeon.Models.DbModels.DiscordUser
you've got missing dependencies
TheCultOfRa
TheCultOfRaOP2y ago
how do you mean?
JakenVeina
JakenVeina2y ago
the error tells you what's wrong you've made a registration for SecurityStampValidator as ISecurityStampValidator SecurityStampValidator requires a dependency of type IPasswordHasher no registration has been made for IPasswordsHasher
TheCultOfRa
TheCultOfRaOP2y ago
oh ok I see thank you!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server