Skip to content

Conversation

@MCard
Copy link

@MCard MCard commented Feb 18, 2025

Web API: Added server-side library components, configurations, and supporting code that will save time including these two optional features in any new client project.
NOTE: Ajay will be adding the corresponding client-side code.

  1. Azure Authentication for SSO with EntraID, B2C, or Registered Apps authentication like for Power BI security tokens.
    • Includes retrieval of user profile data that is accessible from the API or browser Web App.
  2. Power BI Embed for obtaining tokens that display reports in the browser Web App and downloading Power BI or Paginated reports from Power BI to the browser in formats like Excel, PDF, or JPG.

… components for optional features. Needs client-side code.
Copy link
Contributor

@mdbrooks48 mdbrooks48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds a fair amount of code to FF that is not covered in unit tests. Please add unit tests.

//_logger.LogError(ex, model.DisplayFailMessage);
}

return Task.FromResult(model);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use Task.FromResult over async / await?

model.EmbedParameters = Task.FromResult(_powerBiService.GetEmbedParams(reportGuid)).Result;
}

return Task.FromResult(model);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue. Why use Task.FromResult vs async / await?

{
public class GetTrustedIdentityProvidersQueryHandler : IRequestHandler<GetTrustedIdentityProvidersQuery, List<IdentityProviderEntityModel>>
{
private readonly SystemDataService _dbService;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this dependency be ISystemDataService?


public async Task<List<IdentityProviderEntityModel>> Handle(GetTrustedIdentityProvidersQuery request, CancellationToken cancellationToken)
{
return await Task.FromResult(_dbService.GetTrustedIdentityProviderClaimValues());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing. Do you anticipate that the ISystemDataService methods will be async? Either define the interface with async methods or remove the async / await from this method.

{
public class CreateUserProfileCommandHandler : IRequestHandler<CreateUserProfileCommand, int>
{
private readonly SystemDataService _dbService;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this dependency be on ISystemDataService?

using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace NTNMath.Data.Models;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix the namespace to match the project

@@ -0,0 +1,28 @@

namespace referenceApp.Common.Models.Entity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the models in the "Common" project used for? API models should go in the API project. Persistence models in the Persistence project.


[Table("Report")]
[Index("ReportSectionId", Name = "IX_Report_ReportSectionId", IsUnique = true)]
public partial class Report
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a partial class?

// Create a request for getting Embed token
// This method works only with new Power BI V2 workspace experience
// NOTE: Must Exclude Datasets, BI Report IDs, and Roles from the EffectiveIdentity object in 'identities' token request property when BI report has a Paginated Visual.
var tokenRequest = new GenerateTokenRequestV2(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just call the GetEmbedTokenVersion2 method?


#region Implementation Methods

public string? GetAccessToken()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use async / await instead of calling methods with ExecuteAsync().Result?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants