-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
taskTaskTask
Description
AddClientAsync returns the id of the client that was created while AddClientSecretAsync returns the result of calling AutoSaveChangesAsync. In my case I am always seeing a secretId of 1 since that is the number of items I am adding to the database.
Creating a custom ClientRepository and overriding AddClientSecretAsync has solved my issue, but I did have to duplicate the AutoSaveChangesAsync method since it is private.
public override async Task<int> AddClientSecretAsync(int clientId, ClientSecret clientSecret)
{
var client = await DbContext.Clients.Where(x => x.Id == clientId).SingleOrDefaultAsync();
clientSecret.Client = client;
await DbContext.ClientSecrets.AddAsync(clientSecret);
await AutoSaveChangesAsync();
return clientSecret.Id;
}
AddClientClaimAsync and AddClientPropertyAsync both appear to follow the same pattern as AddClientSecretAsync so I would expect to see the issue when calling them as well.
I'm not sure what value a caller should expect in the case that AutoSaveChanges is set to false.
Thanks.