fix up query/check

This commit is contained in:
RaidMax 2022-06-15 20:19:22 -05:00
parent a4923d03f9
commit f02552faa1

View File

@ -39,7 +39,8 @@ namespace SharedLibraryCore.Services
TotalConnectionTime = client.TotalConnectionTime, TotalConnectionTime = client.TotalConnectionTime,
AliasLink = client.AliasLink, AliasLink = client.AliasLink,
Password = client.Password, Password = client.Password,
PasswordSalt = client.PasswordSalt PasswordSalt = client.PasswordSalt,
GameName = client.GameName
}) })
.FirstOrDefault(client => client.NetworkId == networkId && client.GameName == game) .FirstOrDefault(client => client.NetworkId == networkId && client.GameName == game)
); );
@ -237,12 +238,8 @@ namespace SharedLibraryCore.Services
public virtual async Task<EFClient> GetUnique(long entityAttribute, object altKey = null) public virtual async Task<EFClient> GetUnique(long entityAttribute, object altKey = null)
{ {
if (altKey is not Reference.Game game)
{
throw new ArgumentException($"Alternate key must be of type {nameof(Reference.Game)}");
}
await using var context = _contextFactory.CreateContext(false); await using var context = _contextFactory.CreateContext(false);
return await GetUniqueQuery(context, entityAttribute, game); return await GetUniqueQuery(context, entityAttribute, (Reference.Game)altKey);
} }
public async Task<EFClient> Update(EFClient temporalClient) public async Task<EFClient> Update(EFClient temporalClient)