GameShark
GameShark
CC#
Created by GameShark on 5/5/2023 in #help
❔ How to use Database First Approach with asp.net Identity?
Does anyone have experience doing this? Do you have any recommended steps one should follow when doing something like this? When I reverse scaffold, it seems to also create models for my asp.net identity tables. Should I be deleting those?
2 replies
CC#
Created by GameShark on 4/11/2023 in #help
❔ Catching Exceptions with generic parameters?
6 replies
CC#
Created by GameShark on 4/7/2023 in #help
❔ Benefits of using a ServiceManager class over dependency injection?
5 replies
CC#
Created by GameShark on 3/24/2023 in #help
✅ best LINQ method to sort after subtracting two properties?
I have a list of objects with two fields, num1 and num2. I would like to subtract num1 by num2 and then sort descending by the resulting value. Can anyone recommend a LINQ method for this?
8 replies
CC#
Created by GameShark on 11/23/2022 in #help
❔ How do these SQL queries work?
9 replies
CC#
Created by GameShark on 11/19/2022 in #help
❔ Registering a User with Identity and EfCore calls the OnConfiguring Method of my AppDbContext?
Is this supposed to be happening? It seems incredibly inefficient if so. I have attached an animated gif to show what I mean. https://media.discordapp.net/attachments/1043638776200695870/1043638776410415144/Animation.gif
11 replies
CC#
Created by GameShark on 11/12/2022 in #help
❔ Changing object property not limited to scope?
So here in UserManager there is a method:
public virtual async Task UpdateNormalizedUserNameAsync(TUser user)
{
var normalizedName = NormalizeName(await GetUserNameAsync(user).ConfigureAwait(false));
normalizedName = ProtectPersonalData(normalizedName);
await Store.SetNormalizedUserNameAsync(user, normalizedName, CancellationToken).ConfigureAwait(false);
}
public virtual async Task UpdateNormalizedUserNameAsync(TUser user)
{
var normalizedName = NormalizeName(await GetUserNameAsync(user).ConfigureAwait(false));
normalizedName = ProtectPersonalData(normalizedName);
await Store.SetNormalizedUserNameAsync(user, normalizedName, CancellationToken).ConfigureAwait(false);
}
And then in the Store.SetNormalizedUserNamyAsync method:
public virtual Task SetNormalizedUserNameAsync(TUser user, string? normalizedName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
user.NormalizedUserName = normalizedName;
return Task.CompletedTask;
}
public virtual Task SetNormalizedUserNameAsync(TUser user, string? normalizedName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
ThrowIfDisposed();
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
user.NormalizedUserName = normalizedName;
return Task.CompletedTask;
}
There is no ref keyword before TUser. So doesn't that mean setting the user.NormalizedUserName is useless since the change will not be affected by whatever calls it?
8 replies