public Task LogExportedExternalIdentity(ExternalIdentity externalIdentity, Guid externalApplicationId) { var externalSession = new ExternalSession { CorrelationId = externalIdentity.CorrelationId, Created = DateTimeOffset.Now, ExternalApplicationId = externalApplicationId, IdentityId = externalIdentity.IdentityId }; return(_externalSessionStorage.Create(externalSession)); }
public async Task Create(ExternalSession externalSession) { using (var connection = new SqlConnection(_identityOptions.ConnectionString)) { using (var command = new SqlCommand(_createSql, connection)) { command.Parameters.Add(new SqlParameter("@CorrelationId", externalSession.CorrelationId)); command.Parameters.Add(new SqlParameter("@Created", externalSession.Created)); command.Parameters.Add(new SqlParameter("@ExternalApplicationId", externalSession.ExternalApplicationId)); command.Parameters.Add(new SqlParameter("@IdentityId", externalSession.IdentityId)); connection.Open(); externalSession.Id = (int)await command.ExecuteScalarAsync(); } } }